Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Pass a form value from a user control to parent control - Event Order issues

Reply
Thread Tools

Pass a form value from a user control to parent control - Event Order issues

 
 
ab_j@flyingrobot.com
Guest
Posts: n/a
 
      10-29-2004
I have a user control that contains a dropdown which I want to use as a
menu on multiple .aspx pages. Basically, all I am trying to do is pass
the selected value of the dropdown in the user control to the main
..aspx page.

In an attempt to make it more clear on what I am talking about, here is
the order of events in page life cycle (from
http://www.dotnetspider.com/technology/KBPages/789.aspx)
..ascx - OnInit()
..ascx - Page_Init()
..aspx - OnInit()
..aspx - Page_Init()
..aspx - Page_Load()
..ascx - Page_Load()
..ascx or .aspx control events
..aspx - Page_PreRender()
..ascx - Page_PreRender()
..ascx - Page_Unload()
..aspx - Page_Unload()

The problem that I am having is that I can't get the value of the
currently selected option of the dropdown until the ".ascx -
Page_Load()" event, but that doesn't occur until after the ".aspx
- Page_Load()" which is too late.

I experimented with trying to get the value by overriding the
LoadViewState event of the user control(which occurs between
Page_Init() and and Page_Load() but then everything seems to be one
page behind.

So here is my question: How can I pass a form value from a user
control to its parent control when the user control's events are
processed AFTER its parent's events?

It seems to me my only options are:
1) Find a way to get the value before the Page_Onload() event
2) Do all of the code work on the main .aspx page in the
Page_PreRender() phase (is there anything wrong with this?)

I come from a regular asp (vbscript) background so I know that I
sometimes go about these things all wrong. What is the best solution?

BTW, I am referencing a public integer from the user control from the
main page with the following line: MyMenu =
DirectCast(FindControl("user_menu1"), user_menu) Is there a better way?
Any help would be appreciated!

-Aeron

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
If a class Child inherits from Parent, how to implementChild.some_method if Parent.some_method() returns Parent instance ? metal Python 8 10-30-2009 10:31 AM
Need to pass a value from an IFrame to its parent to its parent PKalos@gmail.com Javascript 0 02-02-2006 10:02 AM
Page load of the parent page called twice when a modal dialog is opened from a button click of the user control on the parent page Samy ASP .Net 2 08-15-2005 03:30 PM
User control event - send value to parent Antonio ASP .Net 4 07-21-2005 06:10 PM
Pass from parent to child, then update parent with child value... Noel Dolan Javascript 0 07-18-2004 05:52 PM



Advertisments