- protected void GV_Owner_RowCreated(object sender, GridViewRowEventArgs e)
- {
- if (e.Row.RowType == DataControlRowType.Header)
- {
- Image Img = new Image();
- Img.ImageUrl = "~/Images/print.gif";
- e.Row.Cells[0].Controls.Add(Img);
- e.Row.Cells[0].VerticalAlign = VerticalAlign.Middle;
- }
- }
如上所示,RowCreated方法,判断行类型,如果是header的话(表头),就执行处理。
这里是在第一列添加了一个image对象,当然可以处理别的操作。在此抛砖引玉。
本文介绍如何在ASP.NET的GridView控件的表头中添加一个图片,通过重写RowCreated事件并判断行类型为Header时进行处理。
139

被折叠的 条评论
为什么被折叠?



