首先,請你將不得不在進入模板列控制列。然後,你可以有你有想要的東西 - 一個表,文本框,複選框等
<HeaderTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text=''></asp:TextBox>
<asp:CheckBox ID="CheckBox1" runat="server" />
</HeaderTemplate>
你就必須在RowDataBound事件的進一步控制:
protected void gv_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType != DataControlRowType.Header)
return;
// let the third column span over the next 2 columns.
e.Row.Cells[2].ColumnSpan = 3;
e.Row.Cells[3].Visible = false;
e.Row.Cells[4].Visible = false;
// could span more than 1 row.
e.Row.Cells[2].RowSpan = 2;
等等
在一起,您可以全面控制標題部分。