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 2 1517
Change the control such that when you assign the XML it doesn't build itself
immediaetly. Instead have the control wait to build itself until PreRender.
-Brock http://staff.develop.com/ballen 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
Brock Allen wrote: Change the control such that when you assign the XML it doesn't build itself immediaetly. Instead have the control wait to build itself until PreRender.
-Brock http://staff.develop.com/ballen
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
Hi Brock,
Thanks for the suggestion. I think I had tried that at some point
already.
Anyway I did an override of OnPreRender method for the control itself
and now the event is not being fired. The page does postback, but the
events are not fired.
What I had to do is save the whole xml damn thing to viewstate, so when
the control reloads it gets the xml from viewstate, then the event
simply adds more xml to it and tells the tree to add the new folders.
I'm not happy with this solution though. There must be a better way of
dealing with this situation I hope!
Thanks,
webO This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Christopher W. Douglas |
last post by:
I am writing a VB.NET application in Visual Studio 2003. I have written a
method that handles several events, such as closing a form and changing the
visible status of a form. I have some code...
|
by: Russell Smallwood |
last post by:
Hello all,
Why can't I wire up an event during the "Raise PostBackEvent" stage of a
postback?
Just in case this is the wrong question, the situation:
deep in the bowls of some code-behind...
|
by: Sridhar |
last post by:
Hi,
I have created a web page which includes a place holder. I also have a
dropdown list in that webpage. when I select one of the choices in that
dropdown list, It will load a user control...
|
by: Amit D.Shinde |
last post by:
I am adding a new picturebox control at runtime on the form
How can i create click event handler for this control
Amit Shinde
|
by: Steve |
last post by:
I have a datagrid in a WinForm.
When the user edits an entry in the datagrid, after he leaves that field, I
would like to do some cheking. What event fires when the user does that?
I need to...
| |
by: Developer_Software |
last post by:
Thanks in advance to anyone who can help :)
I've got a placeholder control WITHIN A USER CONTROL that has its contents
dynamically added and removed at runtime by a regular .aspx page.
At...
|
by: c676228 |
last post by:
Hi all,
I have an event in user control email to handling email change when user
want to change the input for email address. Here it is
In email.ascx.vb:
Protected Sub UpdateEmail(ByVal sender As...
|
by: EricRybarczyk |
last post by:
I am starting a rewrite of an existing Classic ASP web site in ASP.NET 2.0.
The existing ASP application has several types of users, each with a separate
login process (separate login page,...
|
by: Frinavale |
last post by:
Introduction
I've seen many questions asked about how to disable the browser's back button and in the past I've replied with "it's simply not possible". It's not a good idea to disable the back...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |