Access EventArgs from PageLoad
-
Is there any way to access the System.EventArgs of a Click event from the Page_Load event? My problem is as follows: I have a page which is constructed of usercontrols (ascx), so I have a menu usercontrol, another navigation control and a main content control. The problem is when I click on a menu item (in order to navigate to another page), the Page_Load event is fired for every usercontrol in the page before the ItemClick event is fired for the menu control, and as a result the main content page loads again, and only after that when the click event fires, the user is redirected to a new page. This basically introduces an unnecessary processing of the page I'm navigation away from. I have hacked my way by interpreting who has postbacked the page in the Page_Load of the menu control, but I need access to the EventArgs of that method. I've managed to get the ID of the element sent as event argument using
Page.Request.Params["__EVENTARGUMENT"]
but I need the whole object. Any ideas?Cheers, Mircea "Pay people peanuts and you get monkeys" - David Ogilvy
-
Is there any way to access the System.EventArgs of a Click event from the Page_Load event? My problem is as follows: I have a page which is constructed of usercontrols (ascx), so I have a menu usercontrol, another navigation control and a main content control. The problem is when I click on a menu item (in order to navigate to another page), the Page_Load event is fired for every usercontrol in the page before the ItemClick event is fired for the menu control, and as a result the main content page loads again, and only after that when the click event fires, the user is redirected to a new page. This basically introduces an unnecessary processing of the page I'm navigation away from. I have hacked my way by interpreting who has postbacked the page in the Page_Load of the menu control, but I need access to the EventArgs of that method. I've managed to get the ID of the element sent as event argument using
Page.Request.Params["__EVENTARGUMENT"]
but I need the whole object. Any ideas?Cheers, Mircea "Pay people peanuts and you get monkeys" - David Ogilvy
Hope this will help you to solve your problem.
SSK. Anyone who says sunshine brings happiness has never danced in the rain.
-
Hope this will help you to solve your problem.
SSK. Anyone who says sunshine brings happiness has never danced in the rain.
Thanks, but I don't see how ViewState could help me. I'm not trying to persist a state. I just want to get a reference to the EventArgs of processing events (Click in my case), from the Page_Load method (which fires before the processing events).
Cheers, Mircea "Pay people peanuts and you get monkeys" - David Ogilvy
-
Thanks, but I don't see how ViewState could help me. I'm not trying to persist a state. I just want to get a reference to the EventArgs of processing events (Click in my case), from the Page_Load method (which fires before the processing events).
Cheers, Mircea "Pay people peanuts and you get monkeys" - David Ogilvy
Ok i will try to work it out your problem and get back to you in few minutes.
SSK. Anyone who says sunshine brings happiness has never danced in the rain.
-
Is there any way to access the System.EventArgs of a Click event from the Page_Load event? My problem is as follows: I have a page which is constructed of usercontrols (ascx), so I have a menu usercontrol, another navigation control and a main content control. The problem is when I click on a menu item (in order to navigate to another page), the Page_Load event is fired for every usercontrol in the page before the ItemClick event is fired for the menu control, and as a result the main content page loads again, and only after that when the click event fires, the user is redirected to a new page. This basically introduces an unnecessary processing of the page I'm navigation away from. I have hacked my way by interpreting who has postbacked the page in the Page_Load of the menu control, but I need access to the EventArgs of that method. I've managed to get the ID of the element sent as event argument using
Page.Request.Params["__EVENTARGUMENT"]
but I need the whole object. Any ideas?Cheers, Mircea "Pay people peanuts and you get monkeys" - David Ogilvy
The event arguments for the event doesn't exist when the Page_Load method is run. They are created when the event handler for the click event is called. What data from the event arguments is it that you need?
Experience is the sum of all the mistakes you have done.
-
The event arguments for the event doesn't exist when the Page_Load method is run. They are created when the event handler for the click event is called. What data from the event arguments is it that you need?
Experience is the sum of all the mistakes you have done.
The menu is a Telerik usercontrol called radMenu. The items of the menu are objects that contain different properties (on the serverside) and are rendered as tables after the page loads. When clicking on a menu item a Javascript like
__doPostBack(_telerikControlID_,_itemID_)
is called. whereitemID
is the ID of the table that contains the items. What I need to access is a property of that menu item clicked. The itemID isn't helping me and the needed property is not rendred in the page. So I need to somehow recreate the objects based on their IDs like the framework does. Do you have any idea how I could do that?Cheers, Mircea "Pay people peanuts and you get monkeys" - David Ogilvy