How to share data between two controls????????????????????????????????????????????????????????

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi!



I have a big big problem!!!

:(



what I will do:



on my web form: UpdateFacility.aspx



are two controls: SearchFacility.ascx and AddEditFacility.ascx



SearchFacility has a dropdown list. when the user choose an item from the
dropdown list the SearchFacility should transfer the selected item value to
a text box on the second control (AddEditFacility).



I try it so:



I set:

ViewState.Add("currentFacilityOID", _ddlFacilities.SelectedItem.Value);



On the InitializeComponent() in AddEditFacility is
ViewState["currentFacilityOID"] ever null.

It seems that on this web form are 3 different ViewStates:



1. ViewState on the UpdateFacility.aspx

2. ViewState on the SearchFacility.ascx

3. ViewState on the AddEditFacility.ascx´



But why?



One possibility that I see is to make this:

Application.Add("currentFacilityOID", _ddlFacilities.SelectedItem.Value);

But I don't want to use the Application object.





Exists any possibility to share data between two controls on the same web
form????







Best Regards,





gicio
 
All you need to do is handle the SelectedIndexChanged event of the
SearchFacility dropdown and in the handler set the edit box value.
EditBox.Text = DropList.SelectedValue.
 
Back
Top