protected void GridView_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Header)
{
e.Row.Cells[1].Visible = false;
e.Row.Cells[2].Visible = false;
}
}
取值:
GridView.Rows [i].Cells [1].Text
或
<asp:HiddenField ID="Hd_SH" Value='<%#DataBinder.Eval(Container.DataItem,"BH")%>' runat="server" />
或
<asp:BoundField DataField="BH" HeaderText="">
<ControlStyle CssClass="hidden" />
<FooterStyle CssClass="hidden"/>
<HeaderStyle CssClass="hidden"/>
<ItemStyle CssClass="hidden"/>
</asp:BoundField>
.hidden
{
display:none;
}
{
if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Header)
{
e.Row.Cells[1].Visible = false;
e.Row.Cells[2].Visible = false;
}
}
取值:
GridView.Rows [i].Cells [1].Text
或
<asp:HiddenField ID="Hd_SH" Value='<%#DataBinder.Eval(Container.DataItem,"BH")%>' runat="server" />
或
<asp:BoundField DataField="BH" HeaderText="">
<ControlStyle CssClass="hidden" />
<FooterStyle CssClass="hidden"/>
<HeaderStyle CssClass="hidden"/>
<ItemStyle CssClass="hidden"/>
</asp:BoundField>
.hidden
{
display:none;
}