Get control of RaGrid through asp button

2 posts, 1 answers
  1. John
    John avatar
    7 posts
    Member since:
    Jul 2013

    Posted 11 Jul 2013 Link to this post

    Hi,

    I have a RadGrid Inside TabTemplate of RadTabStrip. I upload the data to RadGrid from an asp button click event(c# ode).

    The problem is I am not able to findcontrol of RadGrid from the button. 

    Can someone tell me how to get around this problem?

    Code for Button:

    protected void Button2_Click(object sender, EventArgs e)
    {filldata();
    }
    filldata()
    {
    radgrid1.DataSource=list; // list is my data source
    radgrid1.DataBind();
    }


    Also, I don't have license to Radtabs hence using TabTemplate. I have also tried findcontrol but its not working with button EvenArgs.

    RadGrid grv1 = (RadGrid)RadTabStrip1.FindControl("radgrid1");

    Thanks,
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 12 Jul 2013 Link to this post

    Hi John

    Try the following code snippet to access the control inside TabTemplate
    protected void button_Click(object sender, EventArgs e)
       {
           RadTab tab = (RadTab)RadTabStrip1.FindTabByText("Products"); // Get the tab
           RadGrid rGrid = (RadGrid)tab.FindControl("RadGrid1");
       }

    Thanks
    Shinu
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top