473,224 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

Dynamic TreeView loses PopulateOnDemand

Hi,

I'm working on a pagination control and I need to dynamically rerender
a treeview to display the next set of nodes depending on which page
we're on. For example, page 1 will dispaly only nodes 1 to 10, but
when the user clicks [next], the tree will display nodes 11 to 20.

Page 1 will is loaded when the page that contains the ascx (parent of
the treeview) is loaded. This is all cool. The treeview displays
correctly. When I click the [+] to expand a node, the node expands and
its children are populated on demand. But whenever a new page is
displayed, that is a new rendering of the user control that has the
treeview now populated with the next set of nodes, expanding a node
does a post back; it loses its ability to populate on demand.

To get the next set of nodes for my pagination control, i've
implemented the ICallbackEventHandler on the user control that hosts
the treeview. (because I'll be updating other controls such as
textboxes, etc based on the page number as well). In the
RaiseCallbackEvent, i have the logic to clear the nodes and repopulate
the treeview with the new nodes...
void RaiseCallbackEvent(String eventArgument)
{
int index = Convert.ToInt32(eventArgument);
lbPageNumber.InnerText = index.ToString();
LoadPage(index, 4); //method for clearing nodes and getting new
node data from db
}
and in the GetCallbackResult method, i render the ascx control to an
htmlwriter so that i can send back its html representation...
String ICallbackEventHandler.GetCallbackResult()
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
HtmlTextWriter wr = new HtmlTextWriter(new StringWriter(sb));
foreach (Control c in this.Controls)
{
c.RenderControl(wr);
}
return sb.ToString();
}

No errors are thrown, but when i display this html to the page or
section that will display it, clicking on the [+] signs to expand the
nodes does a postback rather than a callback to populate the nodes on
demand. Does anybody have a clue as to why RenderControl strips out
the treeview's callback scripts from the html??

Dec 22 '06 #1
1 4880
Something similar perhaps

I have the following problem:

an asp.net treeview for which an initial set of nodes are retrieved and

subsequently on expand the child nodes are retrieved once

for the initial set of nodes asp.net produces an 'javascript:onclick()' in

the anchor element of each of these nodes that allows getting the selected

node later, the onclick handler 'remembers' the selected node for later use

and is generated by asp.net (webresource.asd or something like that)

for the childnodes retrieved later it does not produce this snip

how can I make these childnodes have this snip as well without resorting to

filtering and patching the output towards the client?

many thanks in advance

<do****@gmail.comwrote in message
news:11**********************@f1g2000cwa.googlegro ups.com...
Hi,

I'm working on a pagination control and I need to dynamically rerender
a treeview to display the next set of nodes depending on which page
we're on. For example, page 1 will dispaly only nodes 1 to 10, but
when the user clicks [next], the tree will display nodes 11 to 20.

Page 1 will is loaded when the page that contains the ascx (parent of
the treeview) is loaded. This is all cool. The treeview displays
correctly. When I click the [+] to expand a node, the node expands and
its children are populated on demand. But whenever a new page is
displayed, that is a new rendering of the user control that has the
treeview now populated with the next set of nodes, expanding a node
does a post back; it loses its ability to populate on demand.

To get the next set of nodes for my pagination control, i've
implemented the ICallbackEventHandler on the user control that hosts
the treeview. (because I'll be updating other controls such as
textboxes, etc based on the page number as well). In the
RaiseCallbackEvent, i have the logic to clear the nodes and repopulate
the treeview with the new nodes...
void RaiseCallbackEvent(String eventArgument)
{
int index = Convert.ToInt32(eventArgument);
lbPageNumber.InnerText = index.ToString();
LoadPage(index, 4); //method for clearing nodes and getting new
node data from db
}
and in the GetCallbackResult method, i render the ascx control to an
htmlwriter so that i can send back its html representation...
String ICallbackEventHandler.GetCallbackResult()
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
HtmlTextWriter wr = new HtmlTextWriter(new StringWriter(sb));
foreach (Control c in this.Controls)
{
c.RenderControl(wr);
}
return sb.ToString();
}

No errors are thrown, but when i display this html to the page or
section that will display it, clicking on the [+] signs to expand the
nodes does a postback rather than a callback to populate the nodes on
demand. Does anybody have a clue as to why RenderControl strips out
the treeview's callback scripts from the html??

Dec 23 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tony Sedgwick | last post by:
I've created a treeview that sits in a separate frame to the main frame and is loaded dynamically from a SQL db. Everything was working fine until I needed a node that could both Expand to...
1
by: Mark | last post by:
Hello, I am using the new TreeView in ASP.Net 2.0. I am using its PopulateOnDemand feature. The problem is that the treeviews +/- images, and any checkboxes, have the tooltip set. If the node...
0
by: drop | last post by:
Hi, I'm currently working with the Treeview control in ASP .Net 2.0. The tree is filled dynamically based on data contained in a MySQL Database. Here is the exact behavior I want : 1 - User...
1
by: aaronh64 | last post by:
I'm trying to bind to the ASP.NET TreeView control and utilize the PopulateOnDemand functionality. However, I am receiving the following (very confusing) error: "PopulateOnDemand only supported...
2
by: makennedy | last post by:
Hi Experts, Please help, I am a newbie to ASP.NET 2.0 may be I am doing something wrong or there may be a bug somewhere. Basically I have a TreeView Control which I have created...
11
by: pbd22 | last post by:
Hi. I am getting odd treeview results and hope you can help. I am parsing a string, "x/y/z", turning it into an array (that always seems to start with an empty string) and then using the...
1
by: Falcula | last post by:
Hello, I have a treeview control, when i select a item i navigate to url. But selected node is lost, it reset itself, loosing state. I post my code here. Thanks in advance. <script...
0
by: Falcula | last post by:
Hello, I have a treeview that i fill from a database, when i update nodename in database the treeview dont update. Its works when iam not useing enableviewstate="true" but then i loosing the...
0
by: =?Utf-8?B?QnJpYW4gTmljaG9sc29u?= | last post by:
Hello, I've created a treeview control that gives a folder browser view of a given computer. The treeview is populated using the following methods: Protected Sub treeDst_Init(ByVal sender...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.