How to send variables from one user control to another on the same asp.net web page during a postback without using session variables? Hidden fields could be an option, anything else?
views:
232answers:
4
+2
A:
In general, controls on a page should know very little about each other.
However, the page knows about them both. Have a property on the first control that the page will read, then the page will use that value to set a property on the second control.
John Saunders
2009-06-25 18:20:14
A:
Each control can have properties that are retained using viewstate, on page load assign the property to a variable on the page, the other control can be set using this
Stuart
2009-06-25 18:22:37
+1
A:
User controls should be independent entities. The best way to communicate among them is by using events. The containing page is responsible for subscribing to and handling events, and coordinating actions among user controls.
Jamie Ide
2009-06-25 18:25:22
do you have a link to sample? the topic makes sense but implementation is not easy for me
Tony_Henrich
2009-06-25 20:31:08
Have a look at my reply to this question: http://stackoverflow.com/questions/839365/best-way-to-display-search-results-on-the-same-page-as-the-search-control-in-asp
Jamie Ide
2009-06-25 21:52:00