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 t开发者_开发技巧he same in page prerender event?
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);
}
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.
精彩评论