开发者

Is it possible to add a Image to the control collection of the header of RadGrid

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜