iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hi - I'm doing a trial of the the Intersoft Webgrid and want to know how to do the display data on the Grid; I did to databind the grid (on the server side) to a IList<T> where T is a custom class.
The grid currently displays the data from all the columns.I would like to show only select colums from my IList.
In short I would like to know how to disable the AutoGenerateColumns and display only the columns that I need.
Please advise on how this can be done ? Your timely help is appreciated.Thanks Kaushik
Your timely help is appreciated.
Thanks Kaushik
In order to define you own column to display you need to implement the PrepareDataBinding event handler and define the WebGrid table column you wish to display. In most of the Intersoft provided sample, the column generation is using RetrieveStructure function to auto generate the column based on the binded data schema.
Here is the snippet to show certain column of the datasource, for this example we would like to show column id, firstname, lastname, and value:
protected void grdObj_PrepareDataBinding(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e){ if (!Page.IsPostBack ) { WebGridColumn wgColID = new WebGridColumn(); wgColID.Caption = "ID"; wgColID.DataMember = "id"; wgColID.Name = "id"; wgColID.Width = Unit.Pixel(150); grdObj.RootTable.Columns.Add(wgColID); WebGridColumn wgColFirstName = new WebGridColumn(); wgColFirstName.Caption = "First Name"; wgColFirstName.DataMember = "firstname"; wgColFirstName.Name = "firstname"; wgColFirstName.Width = Unit.Pixel(250); grdObj.RootTable.Columns.Add(wgColFirstName); WebGridColumn wgColLastName = new WebGridColumn(); wgColLastName.Caption = "Last Name"; wgColLastName.DataMember = "lastname"; wgColLastName.Name = "lastname"; wgColLastName.Width = Unit.Pixel(250); grdObj.RootTable.Columns.Add(wgColLastName); WebGridColumn wgColValue = new WebGridColumn(); wgColValue.Caption = "Value"; wgColValue.DataMember = "value"; wgColValue.Name = "value"; wgColValue.Width = Unit.Pixel(150); wgColValue.DataType = "System.Int32"; grdObj.RootTable.Columns.Add(wgColValue); }}
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname