Pass values between user controls?

Discussion in 'ASP .Net' started by =?Utf-8?B?RGF2ZQ==?=, Jun 2, 2004.

  1. I broke a complex page into two user controls within a container .aspx thinking I would make it more manageable

    UserControl1 contains a datagrid. Upon clicking a row on this grid I want to make the container and UserControl2 aware
    of the selected key ID from the code below. This ID will be used to perform a query in UserControl2 and perform and XSL Transform

    Code within UserControl1
    -----------------------

    private void dgGrid1_ItemCommand(Object src, DataGridCommandEventArgs e

    if (e.Item.ItemIndex >= 0)

    //--Get the posted values from the datagrid..
    dgGrid1.SelectedIndex = e.Item.ItemIndex
    string sId = dgGrid1.DataKeys[e.Item.ItemIndex].ToString()



    Bascially, I have these specific questions
    Where and how do I make the Container and UserControl2 aware of this ID?
    If so, can I get this ID in the Page_Load during the PostBack of the container? This event occurs after the page_load

    Thanks, Dave
    =?Utf-8?B?RGF2ZQ==?=, Jun 2, 2004
    #1
    1. Advertising

  2. =?Utf-8?B?RGF2ZQ==?=

    Tanveer1909

    Joined:
    Aug 27, 2007
    Messages:
    3
    Tanvtech:
    There are so many ways to do,
    In the comman event find the second control and set the value
    UserControl x = (UserControl)this.Page.FindControl("UserControlOne1");
    if (x != null)
    {
    }
    Tanveer1909, Sep 13, 2010
    #2
    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. Marco Antonio Montalvo Durán
    Replies:
    2
    Views:
    4,082
    Matt Morris
    Jan 23, 2004
  2. cwwilly
    Replies:
    1
    Views:
    461
    Christophe Vanfleteren
    Apr 19, 2004
  3. blufox
    Replies:
    2
    Views:
    542
  4. Replies:
    3
    Views:
    358
    Angel
    Feb 6, 2008
  5. Peter K

    Passing values between user controls

    Peter K, Jan 13, 2010, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    1,118
    Nathan Sokalski
    Feb 18, 2010
Loading...

Share This Page