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

RadGrid dynamic Header template

3 Answers 185 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shyam
Top achievements
Rank 1
Shyam asked on 28 Dec 2011, 06:32 AM
Hi,
I'm trying to add button in the header of the dynamically created  column.
Can you give me an idea how to do that.

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 28 Dec 2011, 06:51 AM
Hello,

Try the following code snippet.
CS:
protected void grid_ItemCreated(object sender, GridItemEventArgs e)
{
  if (e.Item is GridHeaderItem)
        {
            GridHeaderItem item = (GridHeaderItem)e.Item;
            Button Button1= new Button();
            Button1.Text = "My text";
            TableCell cell = (TableCell)item["ColumnUniqueName"];
            cell.Controls.Add(Button1);
        }
 }

Thanks,
Princy.
0
Shyam
Top achievements
Rank 1
answered on 28 Dec 2011, 07:05 AM
Thanks for reply Princy.
Let me more clear on this. I am adding dynamic column and while adding I need to add header with the button. And hope I will get button click event also.
0
Shyam
Top achievements
Rank 1
answered on 28 Dec 2011, 07:25 AM
Thanks Princy. After some work around I found the right solution for me.
Tags
Grid
Asked by
Shyam
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Shyam
Top achievements
Rank 1
Share this question
or