﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - WebGrid Enterprise - Display Select columns in Webgrid</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Display-Select-columns-in-Webgrid-AutoGenerateColumns/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>Display Select columns in Webgrid</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Display-Select-columns-in-Webgrid-AutoGenerateColumns/</link><pubDate>Fri, 28 Aug 2009 05:50:45 GMT</pubDate><dc:creator>Glayaar</dc:creator><description>&lt;p&gt;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.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;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: &lt;br /&gt;&lt;/p&gt;&lt;pre&gt;protected void grdObj_PrepareDataBinding(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e)&lt;br /&gt;{&lt;br /&gt;    if (!Page.IsPostBack )&lt;br /&gt;    {&lt;br /&gt;        WebGridColumn wgColID = new WebGridColumn();&lt;br /&gt;        wgColID.Caption = "ID";&lt;br /&gt;        wgColID.DataMember = "id";&lt;br /&gt;        wgColID.Name = "id";&lt;br /&gt;        wgColID.Width = Unit.Pixel(150);&lt;br /&gt;        grdObj.RootTable.Columns.Add(wgColID);&lt;br /&gt;&lt;br /&gt;        WebGridColumn wgColFirstName = new WebGridColumn();&lt;br /&gt;        wgColFirstName.Caption = "First Name";&lt;br /&gt;        wgColFirstName.DataMember = "firstname";&lt;br /&gt;        wgColFirstName.Name = "firstname";&lt;br /&gt;        wgColFirstName.Width = Unit.Pixel(250);&lt;br /&gt;        grdObj.RootTable.Columns.Add(wgColFirstName);&lt;br /&gt;&lt;br /&gt;        WebGridColumn wgColLastName = new WebGridColumn();&lt;br /&gt;        wgColLastName.Caption = "Last Name";&lt;br /&gt;        wgColLastName.DataMember = "lastname";&lt;br /&gt;        wgColLastName.Name = "lastname";&lt;br /&gt;        wgColLastName.Width = Unit.Pixel(250);&lt;br /&gt;        grdObj.RootTable.Columns.Add(wgColLastName);&lt;br /&gt;&lt;br /&gt;        WebGridColumn wgColValue = new WebGridColumn();&lt;br /&gt;        wgColValue.Caption = "Value";&lt;br /&gt;        wgColValue.DataMember = "value";&lt;br /&gt;        wgColValue.Name = "value";&lt;br /&gt;        wgColValue.Width = Unit.Pixel(150);&lt;br /&gt;        wgColValue.DataType = "System.Int32";&lt;br /&gt;        grdObj.RootTable.Columns.Add(wgColValue);&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</description></item><item><title>Display Select columns in Webgrid</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Display-Select-columns-in-Webgrid-AutoGenerateColumns/</link><pubDate>Thu, 27 Aug 2009 08:56:37 GMT</pubDate><dc:creator>kaushik.subramanya</dc:creator><description>&lt;div class="clear"&gt;&lt;/div&gt;
&lt;div class="postcontent" id="ctl00_ctl00_ctl00_ctl00_a_b_c_e_content0" style="margin-bottom: 10px"&gt;&lt;p class="MsoNormal" style="margin: 0in 0in 0pt"&gt;&lt;span style="font-size: 9pt; font-family: 'arial','sans-serif'"&gt;Hi -&lt;br /&gt;&lt;br /&gt; I'm doing a trial of the the Intersoft Webgrid and want to know how to do the display data on the Grid;&lt;br /&gt; &lt;br /&gt;I did to databind the grid (on the server side) to a IList&amp;lt;T&amp;gt; where T is a custom class. &lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin: 0in 0in 0pt"&gt;&lt;span style="font-size: 9pt; font-family: 'arial','sans-serif'"&gt;The grid currently displays the data from all the columns.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: 'arial','sans-serif'"&gt;I would like to show only select colums from my IList.  &lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin: 0in 0in 0pt"&gt;&lt;span style="font-size: 9pt; font-family: 'arial','sans-serif'"&gt;In short I would like to know how to disable the AutoGenerateColumns and display only the columns that I need.&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin: 0in 0in 0pt"&gt;&lt;span style="font-size: 9pt; font-family: 'arial','sans-serif'"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 9pt; font-family: 'arial','sans-serif'"&gt;Please advise on how this can be done ? &lt;p class="MsoNormal" style="margin: 0in 0in 0pt"&gt;Your timely help is appreciated.&lt;/p&gt;&lt;p class="MsoNormal" style="margin: 0in 0in 0pt"&gt;&lt;br /&gt;Thanks &lt;br /&gt;Kaushik&lt;/p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin: 0in 0in 0pt"&gt;Your timely help is appreciated.&lt;/p&gt;&lt;p class="MsoNormal" style="margin: 0in 0in 0pt"&gt;&lt;br /&gt;Thanks &lt;br /&gt;Kaushik&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/div&gt;</description></item></channel></rss>