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

How to use RAD Grid in a user control

1 Answer 52 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sarabjeet
Top achievements
Rank 1
Sarabjeet asked on 28 Oct 2011, 05:32 PM
Hi,

I have an exsisting web application. I want to add rad grid to the application.
Can I create a custom user control having Rad grid and being used in diffrent web pages as required with their custom data?

It will be very helpfull if any one can provide a small sample with a page and a user control having Rad grid,  and populating data from main page on a button click.

Thanks

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 29 Oct 2011, 06:36 AM
Hello Sarabjeet,

You can try the following code snippet to populate the RadGrid in a UserControl.
C#:
protected void btn_Click(object sender, EventArgs e)
{
  RadGrid grid = (RadGrid)UserControl1.FindControl("RadGrid2");
  grid.AutoGenerateColumns = true;
  grid.DataSourceID = "SqlDataSource1";
  grid.DataBind();
}

Thanks,
Shinu.
Tags
Grid
Asked by
Sarabjeet
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or