2 user controls on an aspx page

3 posts, 0 answers
  1. Helen
    Helen avatar
    42 posts
    Member since:
    Nov 2013

    Posted 27 Mar 2014 Link to this post


    I've been reading through your help doc and also searched through the forum on how to pass parameter from one user control (UC1) to another user control (UC2), but still not quite getting it, hopefully you could help me understand it better.

    I created a small project as below:

    My aspx page contains UC1 (a grid) and UC2 (a textbox).  When UC1 gets clicked, it'll get the location id and I need to pass that value to UC2 to display it.
    RadAjaxManager is on the aspx page and RadAjaxManagerProxy is set up in each user controls.

    The closest I can find is this from your help doc :


    Is this the way I should follow to send data from one user control to another by using bubble event or is there another way you would recommend?

    Thank you,

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 28 Mar 2014 in reply to Helen Link to this post

    Hi Helen,

    The event bubbling approach will use if we load a user control dynamically from an action in another loaded user control. If you are loading second user control dynamically from first user control then please follow the event bubbling approach. Please have a look into the sample code snippet where I am loading both of the UserControl statically and accessing one user control from another.

    <uc1:Grid ID="Grid1" runat="server" />
    <uc2:TextBox ID="TextBox1" runat="server" />
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">

    <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <telerik:AjaxUpdatedControl ControlID="RadTextBox1" />
    <telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource"
        <ClientSettings EnablePostBackOnRowClick="true" Selecting-AllowRowSelect="true">

    protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        var departments = new[] {
                new { DeptID = 1, Abbr = "ACME", Name = "ACME Corporation" },
                new { DeptID = 2, Abbr = "MSFT", Name = "Microsoft Corporation" },
                new { DeptID = 3, Abbr = "GOOG", Name = "Google, Inc" }
        RadGrid1.DataSource = departments;
    protected void RadGrid1_SelectedIndexChanged(object sender, EventArgs e)
        //code for acceessing the grid data item
        UserControl control = (UserControl)Page.FindControl("TextBox1"); //id of the usercontrolpage
        RadTextBox textbox = (RadTextBox)control.FindControl("RadTextBox1"); //id of the RadTextBox
        //your code for updating the value of the textbox

    <telerik:RadTextBox ID="RadTextBox1" runat="server" Text="dd">

    Let me know if you have any concern.
  3. Helen
    Helen avatar
    42 posts
    Member since:
    Nov 2013

    Posted 28 Mar 2014 in reply to Shinu Link to this post


    Thank you, the sample helps me much better!!

Back to Top