views:

27

answers:

2

I would like to add and Image along with the HeaderText in RadGrid. I can able to do this in ItemBound event. But is there any possible ways to do the same in page prerender event?

A: 

is possible, but do not know if it's a good idea.

((GridHeaderItem)((GridTHead)grid.MasterTableView.Controls[0].Controls[0]).Controls[1]).Cells[2].Text= "Test!"

it is good to check the types of controls.

I tried this, but doesnt work.
Nathan
A: 

I got it worked, here is the code to add the image in pre render event.

protected void RadGrid1_PreRender(object sender, EventArgs e)
   {
       GridHeaderItem headerItem = (GridHeaderItem)RadGrid1.MasterTableView.GetItems(GridItemType.Header)[0];
       Image img = new Image();
       img.ImageUrl = "~/Images/Refresh.gif";
       headerItem["FirstName"].Controls.AddAt(1, img);
   }
Nathan