how to hide GridView column when data is accessed dynamically in gridview
hii
I have 2 gridviews they are bind by sqldatasource ,it contains Id , Name and Price
i dont want to show ID coloumn when page is loaded.How to开发者_StackOverflow中文版 hide it?
Add Visible="false" to the column declaration, or in code.
protected void gvDocuments_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.Cells[1].Visible = false;
}
You can also hide the column from the code where you feel like.
this.DataGridView1.Columns["ID coloumn"].Visible = false;
Regards.
精彩评论