How to share data between two controls

Discussion in 'ASP .Net Building Controls' started by Guest, Jan 8, 2004.

  1. Guest

    Guest Guest

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

    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
     
    Guest, Jan 8, 2004
    #1
    1. Advertising

  2. Guest

    kelly leahy Guest

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

    >
    >Exists any possibility to share data between two

    controls on the same web
    >form????
    >


    What about adding a hidden element to the form and using
    it to share the info?

    Just make an <INPUT TYPE=HIDDEN ID="someID"></INPUT>.

    On the postback, you can refer to it with Request.Form
    ["someID"] to get the value.

    Kelly
     
    kelly leahy, Jan 8, 2004
    #2
    1. Advertising

  3. Guest

    Eran Amitai Guest

    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.


    <> wrote in message news:btkjui$8bkbo$...
    > 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
    >
    >
     
    Eran Amitai, Jan 11, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eran Amitai
    Replies:
    0
    Views:
    412
    Eran Amitai
    Jan 11, 2004
  2. CharlieHoo
    Replies:
    3
    Views:
    10,304
    Steven Cheng[MSFT]
    Jun 24, 2005
  3. Guest

    How to share data between two controls

    Guest, Jan 8, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    140
    Eran Amitai
    Jan 11, 2004
  4. Saraswati lakki
    Replies:
    0
    Views:
    1,426
    Saraswati lakki
    Jan 6, 2012
  5. Laura Schmidt

    share data between two tomcat contexts?

    Laura Schmidt, May 17, 2014, in forum: Java
    Replies:
    9
    Views:
    214
    Brixomatic
    May 22, 2014
Loading...

Share This Page