隱藏GridView欄位的方法:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
//隱藏標題行
if ( e.Row.RowType == DataControlRowType.Header)
{
e.Row.Cells[0].Visible = false;
}
//隱藏資料欄位
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[0].Visible = false;
}
}
0 意見: