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?
views:
27answers:
2
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
2010-08-30 12:32:12
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
2010-08-31 12:38:17