﻿<?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 - Add Columns Dynamically to web grid</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Add-Columns-Dynamically-to-web-grid/</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>Add Columns Dynamically to web grid</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Add-Columns-Dynamically-to-web-grid/</link><pubDate>Mon, 18 Jun 2012 22:32:23 GMT</pubDate><dc:creator>bernard</dc:creator><category>Intersoft webUI</category><category>Visual Studio 2008</category><description>&lt;p&gt;Hi Rahul,&lt;/p&gt;&lt;p&gt;Glad to hear that you already solved the problem. If you have question please don't hesitate to ask us. Thank you for your feedback.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Bernard&lt;/p&gt;</description></item><item><title>Add Columns Dynamically to web grid</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Add-Columns-Dynamically-to-web-grid/</link><pubDate>Mon, 18 Jun 2012 01:44:51 GMT</pubDate><dc:creator>rahulpundlik007</dc:creator><category>Intersoft webUI</category><category>Visual Studio 2008</category><description>&lt;blockquote&gt;Hi Rahul,&lt;/div&gt;&lt;div&gt;I can't replicate your code on our local end. I think this problem occurs because of some condition on Page_Load event (maybe there's IsPostBack validation on Page_Load event). To resolved this problem, I suggest you to put LoadColumn() in PrepareDataBinding event.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;I also attach my own sample here. In my sample I use Northwind as sample's database and DataSet.&lt;/div&gt;
&lt;div&gt;Hope it helps.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;Regards,&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;I have refered your code and implimented it to my project it is working fine thanks for your help.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
</description></item><item><title>Add Columns Dynamically to web grid</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Add-Columns-Dynamically-to-web-grid/</link><pubDate>Mon, 04 Jun 2012 23:54:21 GMT</pubDate><dc:creator>bernard</dc:creator><category>Intersoft webUI</category><category>Visual Studio 2008</category><description>Hi Rahul,&lt;div&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;I can't replicate your code on our local end. I think this problem occurs because of some condition on Page_Load event (maybe there's IsPostBack validation on Page_Load event). To resolved this problem, I suggest you to put LoadColumn() in PrepareDataBinding event.&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;I also attach my own sample here. In my sample I use Northwind as sample's database and DataSet.&lt;/div&gt;
&lt;div&gt;Hope it helps.&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;Regards,&lt;/div&gt;
&lt;div&gt;Bernard&lt;/div&gt;</description></item><item><title>Add Columns Dynamically to web grid</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Add-Columns-Dynamically-to-web-grid/</link><pubDate>Mon, 04 Jun 2012 02:27:40 GMT</pubDate><dc:creator>rahulpundlik007</dc:creator><category>Intersoft webUI</category><category>Visual Studio 2008</category><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I have one Editable intersoft webgrid on my ASPX page, as per the client requirement i want to add few columns to it dynamically in specific conditions. I have done the coding for the same but it is not showing me those dynamic columns initially when grid is get load first time but when i refresh the grid manually then it is showing me the data and those columns correclty. plz suggest me the exact problem bellow is the code.&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;ASPX page&lt;br /&gt;&amp;lt;ISWebGrid:WebGrid ID="wgBaseRates" runat="server" Height="280px" Width="970px" OnInitializeDataSource="wgBaseRates_InitializeDataSource"&lt;br /&gt;                    OnInitializeLayout="wgBaseRates_InitializeLayout" OnUpdateRow="wgBaseRates_OnUpdateRow" OnInitializeRow="wgBaseRates_InitializeRow"&amp;gt;&lt;br /&gt;                    &amp;lt;LayoutSettings AllowEdit="Yes" AllowColumnSizing="Yes" AllowColumnMove="No" AllowExport="Yes"&lt;br /&gt;                        AllowSorting="Yes" PersistRowChecker="true" RowHeightDefault="-1px" EditOnClick="true"&amp;gt;&lt;br /&gt;                        &amp;lt;ClientSideEvents OnRowValidate="wgBaseRates_OnRowValidate" OnCheckBoxClick="SelectHeaderCheckbox" &lt;br /&gt;                        OnBeforeRequest="onUpdating()"  OnAfterResponseProcess="onUpdated();"/&amp;gt;&lt;br /&gt;                        &amp;lt;StatusBarCommandStyle&amp;gt;&lt;br /&gt;                            &amp;lt;Active CssClass="ActiveStatusBarCommandStyle" BaseStyle="Over"&amp;gt;&lt;br /&gt;                            &amp;lt;/Active&amp;gt;&lt;br /&gt;                            &amp;lt;Over CssClass="OverStatusBarCommandStyle"&amp;gt;&lt;br /&gt;                            &amp;lt;/Over&amp;gt;&lt;br /&gt;                            &amp;lt;Normal CssClass="NormalStatusBarCommandStyle"&amp;gt;&lt;br /&gt;                            &amp;lt;/Normal&amp;gt;&lt;br /&gt;                        &amp;lt;/StatusBarCommandStyle&amp;gt;&lt;br /&gt;                        &amp;lt;HeaderStyle CssClass="HeaderStyle" Height="35px" /&amp;gt;&lt;br /&gt;                        &amp;lt;FilterRowStyle CssClass="HeaderStyle" Height="20px"&amp;gt;&lt;br /&gt;                        &amp;lt;/FilterRowStyle&amp;gt;&lt;br /&gt;                        &amp;lt;CheckedRowStyle BackColor="Aqua" CustomRules="HorizontalAlign:auto"&amp;gt;&lt;br /&gt;                        &amp;lt;/CheckedRowStyle&amp;gt;&lt;br /&gt;                        &amp;lt;LostFocusRowStyle CssClass="SelectedRowStyle" /&amp;gt;&lt;br /&gt;                        &amp;lt;FocusCellStyle CssClass="FocusCellStyle" /&amp;gt;&lt;br /&gt;                        &amp;lt;SelectedRowStyle CssClass="SelectedRowStyle" /&amp;gt;&lt;br /&gt;                        &amp;lt;StatusBarStyle CssClass="StatusBarStyle"&amp;gt;&lt;br /&gt;                        &amp;lt;/StatusBarStyle&amp;gt;&lt;br /&gt;                        &amp;lt;AlternatingRowStyle CssClass="AlternatingRowStyle" CustomRules="HorizontalAlign:auto" /&amp;gt;&lt;br /&gt;                        &amp;lt;RowStyle CssClass="RowStyle" CustomRules="HorizontalAlign:auto" /&amp;gt;&lt;br /&gt;                        &amp;lt;FrameStyle CssClass="FrameStyle"&amp;gt;&lt;br /&gt;                        &amp;lt;/FrameStyle&amp;gt;&lt;br /&gt;                        &amp;lt;NewRowStyle CssClass="NewRowStyle"&amp;gt;&lt;br /&gt;                        &amp;lt;/NewRowStyle&amp;gt;&lt;br /&gt;                        &amp;lt;EditFocusCellStyle CssClass="EditFocusCellStyle"&amp;gt;&lt;br /&gt;                        &amp;lt;/EditFocusCellStyle&amp;gt;&lt;br /&gt;                        &amp;lt;GroupRowInfoStyle CssClass="GroupRowInfoStyle"&amp;gt;&lt;br /&gt;                        &amp;lt;/GroupRowInfoStyle&amp;gt;&lt;br /&gt;                        &amp;lt;GroupByBox&amp;gt;&lt;br /&gt;                            &amp;lt;LabelStyle CssClass="GroupByBoxLabelStyle" /&amp;gt;&lt;br /&gt;                            &amp;lt;Style CssClass="GroupByBoxStyle"&amp;gt;&lt;br /&gt;                                &amp;lt;/Style&amp;gt;&lt;br /&gt;                        &amp;lt;/GroupByBox&amp;gt;&lt;br /&gt;                    &amp;lt;/LayoutSettings&amp;gt;&lt;br /&gt;                &amp;lt;/ISWebGrid:WebGrid&amp;gt;&lt;br /&gt;ASPX.CS&lt;br /&gt;//Calling Bellow Method in Page load&lt;br /&gt; public void LoadColumns()&lt;br /&gt;        {&lt;br /&gt;            //Declaring and assigning properties for grid&lt;br /&gt;            WebGridColumn _RowChecker = new WebGridColumn("Column1", "Column1", "Cilumn 1", Unit.Pixel(25), ColumnType.CheckBox, EditType.NoEdit, "");&lt;br /&gt;            WebGridColumn _BRDID = new WebGridColumn("Cilumn2", "Column2", "ID", Unit.Pixel(0), ColumnType.Text, EditType.NoEdit, "");&lt;br /&gt;            &lt;br /&gt;            //WebGridColumn _HrType = new WebGridColumn(GEO_CFT_BS_RT_DETAIL_V_Domain.HR_TYPE_DESCFriendlyName, GEO_CFT_BS_RT_DETAIL_V_Domain.HR_TYPE_DESCFriendlyName, "Hr. Type", Unit.Pixel(90), ColumnType.Text, EditType.NoEdit, "");&lt;br /&gt;            &lt;br /&gt;            WebGridColumn _BaseRate = new WebGridColumn("Rate","Rate", "Base Rate", Unit.Pixel(50), ColumnType.Text, EditType.TextBox, "0.00");&lt;br /&gt;            WebGridColumn _FringeRate = new WebGridColumn("FRate","FRate","Fringe", Unit.Pixel(50), ColumnType.Text, EditType.TextBox, "0.00");&lt;br /&gt;            WebGridColumn _OTBaseRate = new WebGridColumn("OTBaseRate", "OTBaseRate", "OT Base Rate", Unit.Pixel(90), ColumnType.Text, EditType.TextBox, "0.00");&lt;br /&gt;            WebGridColumn _OTFringeRate = new WebGridColumn("OTFringeRate", "OTFringeRate", "OT Fringe Rate", Unit.Pixel(90), ColumnType.Text, EditType.TextBox, "0.00");&lt;br /&gt;          &lt;br /&gt;            //Assigning additional properties to base rate details grid columns&lt;br /&gt;            _RowChecker.IsRowChecker = true;&lt;br /&gt;            _RowChecker.IsRowHeader = true;&lt;br /&gt;           &lt;br /&gt;            _BaseRate.InputRequired = true;&lt;br /&gt;            _BaseRate.InputRequiredErrorText = "Please enter base rate";&lt;br /&gt;            _FringeRate.InputRequired = true;&lt;br /&gt;            _BaseRate.InputRequiredErrorText = "Please enter fringe";&lt;br /&gt;            _BaseRate.TextboxMaxlength = 6;&lt;br /&gt;            _FringeRate.TextboxMaxlength = 6;&lt;br /&gt;            _OTBaseRate.TextboxMaxlength = 6;&lt;br /&gt;            _OTFringeRate.TextboxMaxlength = 6;&lt;br /&gt;            &lt;br /&gt;&lt;br /&gt;            //Adding columns to base rate details grid&lt;br /&gt;            wgBaseRates.RootTable.Columns.Add(_RowChecker);&lt;br /&gt;            //wgBaseRates.RootTable.Columns.Add(_HrType);&lt;br /&gt;            wgBaseRates.RootTable.Columns.Add(_BaseRate);&lt;br /&gt;            wgBaseRates.RootTable.Columns.Add(_FringeRate);&lt;br /&gt;            if (Session["OTDT"] != null)&lt;br /&gt;            {&lt;br /&gt;                wgBaseRates.RootTable.Columns.Add(_OTBaseRate);&lt;br /&gt;                wgBaseRates.RootTable.Columns.Add(_OTFringeRate);&lt;br /&gt;               &lt;br /&gt;            }&lt;br /&gt;  &lt;br /&gt;            wgBaseRates.RootTable.Columns.Add(_BRDID);&lt;br /&gt;           &lt;br /&gt;        }&lt;br /&gt; protected void wgBaseRates_InitializeDataSource(object sender, DataSourceEventArgs e)&lt;br /&gt;{&lt;br /&gt;       //Populating datatable and assigning to datasource.&lt;br /&gt;       e.DataSource = CreateNewDatatable(_Dtcopy);&lt;br /&gt;}&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>