This walkthrough shows you how to hide certain column programmatically in server side.
During this walkthrough, you will learn how to do the following :
- Binding Flat Datasource to WebGrid.
- Hide certain column programmatically in WebGrid's InitializeRow server side event.
Prerequisites
In order to complete this walkthrough, you will need the following:
- Access to the Microsoft Access Northwind database.
- Visual Studio 2003 Application.
Step-By-Step Instructions
- Binding WebGrid to AccessDataSource.
- Add the following codes in InitializeRow server side event:
C# Copy Code protected void WebGrid1_InitializeLayout(object sender, ISNet.WebUI.WebGrid.LayoutEventArgs e) { WebGrid1.RootTable.Columns.GetNamedItem("Address").Visible = false; WebGrid1.RootTable.Columns.GetNamedItem("CompanyName").Visible = false; }