The OnInitializeLayout server-side event should be used when the Grid layout needs to be initialized during data binding. You can write the code to dynamically add Columns, GroupedColumns, or other objects in this event. First, the data source and data member of the WebGrid must be configured appropriately. By default, the column header of the WebGrid is visible during initialization. In order to disable the column header of the WebGrid, we need to modify the ColumnHeaders property of the WebGrid Table to ColumnVisibility.No.
This article focuses on how to disable the column header either of the root tables or child tables by using the OnInitializeLayout server-side event of WebGrid.
In this article, you will perform the following tasks:
- Implement the OnInitializeLayout server-side event of WebGrid
Implement the OnInitializeLayout server-side event of WebGrid
The following code needs to be inserted on WebGrid’s OnInitializeLayout Server-side event:
protected void WebGrid1_InitializeLayout(object sender, ISNet.WebUI.WebGrid.LayoutEventArgs e)
{
// disable the column header of the child table
WebGrid1.RootTable.ChildTables.GetNamedItem("NameOfTable").ColumnHeaders = ISNet.WebUI.WebGrid.ColumnVisibility.No;
// optionally disable the column header of the root table
//WebGrid1.RootTable.ColumnHeaders = ISNet.WebUI.WebGrid.ColumnVisibility.No;
}
References
For more information about WebGrid and its features, see WebGrid Overview.
For more information about Custom Editor Selection in WebGrid, see Custom Editor Selection Overview.
For additional How-to topics, Videos, Knowledge Base and other learning resources available for WebGrid, see WebGrid Support.
Note: This is a "QUICK PUBLISH" article created directly from within the Intersoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.