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

Find radgrid ID from footer (ascx file)

2 Answers 89 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andy
Top achievements
Rank 1
Andy asked on 31 Jan 2011, 08:36 PM
Hi all,

In Footer(ascx file),I would like to find the Radgrid ID which comes from other pages that using the footer.
For example, "Car Information" page uses Radgrid to display car info and it uses "footer.ascx" as its footer.
Now, in the "footer.ascx", I want to get the Radgrid ID in order to change its skin.
Are there any ways to do this?

Thanks.

Andy.

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 01 Feb 2011, 11:53 AM
Hello Andy,

One option is by using Page Item Collection, you can pass the grid from a web page to UserControl like below.

C#:
protected void Page_Load(object sender, EventArgs e)
    {
        RadGrid grid = (RadGrid)this.FindControl("RadGrid1");
        Page.Items.Add("Data", grid);
    }

UserControl code behind:
protected void Page_Load(object sender, EventArgs e)
   {
       RadGrid grid =(RadGrid)Page.Items["Data"];
       grid.Skin = "Outlook";
 
   }

Thanks,
Princy.
0
Andy
Top achievements
Rank 1
answered on 01 Feb 2011, 05:45 PM
Thanks Princy.
Tags
Grid
Asked by
Andy
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Andy
Top achievements
Rank 1
Share this question
or