W
weboweb
Hail the experts!!!
I'm creating a web user control which displays a hierarchical tree of
items from an xml string passed to the control (from the host page)
through an exposed property.
This xml gets created in the Page_Load method of the host page
Each tree item displayed by the control is a LinkButton object.
This LinkButton fires a CommandEventHandler event (when the user
clicks) that is consumed by the page hosting this control.
Everything perfect so far...
The user loads the page, clicks on one of the items, the event gets
fired, the page performs a postback...
Problem is:
When the host page receives the event fired by the tree control, I
would like at this point to get a different XML from the database, then
have the control redraw itself with a different tree.
But how can I do this, since by the time the event raised by the
control gets processed the Page_Load has already finished and the
control is already displaying the old tree?
If I try !IsPostBack in the Page_Load the event will not fire at all.
Basically my question is how in the heck can I update the tree control
from the event method in the host page other than having the page
reload itself using javascript for example?
Also, what is the use of Events in this scenario? Very little in this
case unless I am headed in the wrong direction completely!!!
Many thanks to all, I will post specific code if required, but for now
it's only concepts I need to clarify.
weBo
I'm creating a web user control which displays a hierarchical tree of
items from an xml string passed to the control (from the host page)
through an exposed property.
This xml gets created in the Page_Load method of the host page
Each tree item displayed by the control is a LinkButton object.
This LinkButton fires a CommandEventHandler event (when the user
clicks) that is consumed by the page hosting this control.
Everything perfect so far...
The user loads the page, clicks on one of the items, the event gets
fired, the page performs a postback...
Problem is:
When the host page receives the event fired by the tree control, I
would like at this point to get a different XML from the database, then
have the control redraw itself with a different tree.
But how can I do this, since by the time the event raised by the
control gets processed the Page_Load has already finished and the
control is already displaying the old tree?
If I try !IsPostBack in the Page_Load the event will not fire at all.
Basically my question is how in the heck can I update the tree control
from the event method in the host page other than having the page
reload itself using javascript for example?
Also, what is the use of Events in this scenario? Very little in this
case unless I am headed in the wrong direction completely!!!
Many thanks to all, I will post specific code if required, but for now
it's only concepts I need to clarify.
weBo