How to hide a column in a Datagrid if AutoGenerateColumns is set to True?

Platform: ASP.NET| Category: DataGrid

<asp:DataGrid id='DataGrid1' onItemDataBound='ItemDB' runat='server'></asp:DataGrid>

VB.NET


protected Sub ItemDB (ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)
             e.Item.Cells(0).Visible = False
End Sub

C#


protected void ItemDB (object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
            e.Item.Cells[0].Visible = false;
}

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.