Welcome Guest Search | Active Topics | Sign In | Register

EO.Web.TreeNode.PopulateOnDemand needs ValidateRequest="false" Options
David Porter
Posted: Thursday, June 14, 2007 10:14:31 PM
Rank: Advanced Member
Groups: Member

Joined: 6/14/2007
Posts: 36
Hi There,

I am trying to use the EO.Web.TreeView to build a tree dynamically in the code behind.

The idea is that eventually I wish to populate a TreeView, based on some XML Data (yet to define).

Because I don't have a datasource as such to bind, my approach was to programatticaly create a treeview (potentially by looping through nodes) and then add this control to an ASP Panel on the page.

I need my TreeNodes to contain HTML, as I would like to add some extra "buttons" and other funky HTML stuff to my tree nodes using images, javascript onclicks etc. For this I am using, for example:

Dim oTreeNode As EO.Web.TreeNode

oTreeNode.Text = "<span class='myImageClass'></span><span>here is some text</span>"

This works fine if all of the tree is built on Page Load. However, if I decide to make my tree populate on demand I get errors, but only when I have HTML text in my tree nodes. If I use the following code:

oTreeNode.PopulateOnDemand = True

And set up a Handler for the ItemPopulate Event:

AddHandler oTreeView.ItemPopulate, AddressOf TreeView1_ItemPopulate

When I click to expand a node set up in this way, I get an exception:

---------------------------
Microsoft Internet Explorer

EO.Web Controls Client Side Debug Message:



The callback on 'ctl03' has failed due to a server side exception. Click OK to see the exception message.



You can turn off this message by setting EO.Web.Runtime.DebugLevel to 0 (Not recommended for debug build).

OK
---------------------------


And the ASP Error that follows:

A potentially dangerous Request.Form value was detected from the client (eo_cb_param="...B_X/1B_1
<table border="1"><t...").



It appears to me that the "state" of the node is being passed in the form post, and this includes the node text. As the HTML is not escaped in any way, ASP.NET throws this validation error, unless I set ValidateRequest="false" at the top of the page.


Is this a bug or known issue with the TreeView? I would like to use PopulateOnDemand if possible, for efficiency reasons. Else I'll be building my Tree in one go at the start, which is not ideal if there is a lot of data.

Regards,
David


David Porter
Posted: Thursday, June 14, 2007 11:02:23 PM
Rank: Advanced Member
Groups: Member

Joined: 6/14/2007
Posts: 36
Sorry for the extra post,

Just to clarify, I have also tried using the CustomItem, which is fine for trees built on page load, but I cannot seem to create a customitem dynamically through my handler to "oTreeView.ItemPopulate", as I am not allowed to add new Custom Items at this time.
eo_support
Posted: Friday, June 15, 2007 4:51:55 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,193
Hi David,

You don't want to use CustomItem. It's rather complicated to create them programatically. The issues that you reported looks like a bug. We will look into it and see what we can find.

Thanks
David Porter
Posted: Sunday, June 17, 2007 4:09:49 PM
Rank: Advanced Member
Groups: Member

Joined: 6/14/2007
Posts: 36
Thanks for the quick response :)
eo_support
Posted: Monday, June 18, 2007 7:23:41 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,193
Hi David,

We have fixed the issue. Please see your private message for download location of the new build.

Thanks
David Porter
Posted: Monday, June 18, 2007 2:28:04 PM
Rank: Advanced Member
Groups: Member

Joined: 6/14/2007
Posts: 36
Thanks again, I will take a look! :)
David Porter
Posted: Wednesday, June 20, 2007 9:05:53 PM
Rank: Advanced Member
Groups: Member

Joined: 6/14/2007
Posts: 36
Hi,

Sorry for the delay, I forgot to let you know that I tested my code with the new build and I no longer receive this error.

Thanks again :)


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.