This is a migrated thread and some comments may be shown as answers.

Get control of RaGrid through asp button

1 Answer 15 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 11 Jul 2013, 03:41 PM
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,

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 1
answered on 12 Jul 2013, 07:37 AM
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
Tags
TabStrip
Asked by
John
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or