好了,所以我的目标是到GridView HEADR实例下只加1静态行:
| coloumnHeader1 | coloumnHeader2 | coloumnHeader3 | coloumnHeader4 |
| ----------------------静态行------------------------- - | | DataBoundField | DataBoundField | DataBoundField | DataBoundField | | DataBoundField | DataBoundField | DataBoundField | DataBoundField | | DataBoundField | DataBoundField | DataBoundField | DataBoundField | | DataBoundField | DataBoundField | DataBoundField | DataBoundField | | DataBoundField | DataBoundField | DataBoundField | DataBoundField | | DataBoundField | DataBoundField | DataBoundField | DataBoundField |
| ----------------------页脚-------------------------- ----- |
我的预感是其得到的东西用的RowDataBound但那是据我已经得到了。
我想我需要更好地解释自己:我想要做什么是相当于增加了一个新的HeaderRow ...日Thnx所有助手:d
找到了答案:经过大量的谷歌搜索,我发现我一直在寻找,在ASP
<asp:GridView OnPreRender="grd_Pre" CssClass="table" ID="GridView1" runat="server" AutoGenerateColumns="False"
>
在后面的代码
protected void grd_Pre(object sender, EventArgs e)
{
GridViewRow gv = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Normal);
TableCell tc = new TableCell();
tc.ColumnSpan = 3;
tc.Text = "GridView Header";
tc.Attributes.Add("style", "text-align:center");
gv.Cells.Add(tc);
this.GridView1.Controls[0].Controls.AddAt(0, gv);
}