We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Dynamically Adding column and Hide/Show for column in Grid Control

Hi, I would like to know how can i dynamically add column and hide show column to Grid Grouping control and how can i set the datasource and bind it to Grid Grouping control. Along with this i would like to know how can i add hyperlink column to grid control Thanks & Regards, Manoj Singh.

8 Replies

AD Administrator Syncfusion Team June 29, 2006 06:41 PM UTC

Hi Manoj, Here are my suggestions/answers for your queries. Biding Grid to DataSource: -------------------------- Have a look at our Setting up Data Binding section in our ''UsersGuide'' which you can find here : EssentialGrid->ASp.net->IntroducingEssentialGroupingGrid->UsingGridGroupingControl Also look in to the Tutorial in our ''UsersGuide'' Lesson1:"Essential Grid DataBinding". You can see that binding our grid is very similar like in normal ASP.NET grid control with minor changes. Adding a Column dynamically to the grid : ---------------------------------------- You can initialize a unboundColumn and can make use of it to add columns dynamically by using the following code [vb] Me.GridGroupingControl1.TableDescriptor.UnboundFields.Add("UnBoundColumn") Me.GridGroupingControl1.TableDescriptor.Columns.Add("UnBoundColumn") Me.GridGroupingControl1.TableDescriptor.VisibleColumns.Add("UnBoundColumn") you can fill this column either by handling the ''QueryValue'' event or ''QueryCellStyleInfo'' event. Showing/Hiding Columns: ----------------------- As mentioned in our UsersGuide section under EssentialGrid->Asp.Net->BasicConcepts Showing/Hiding Columns can be acheived as follows. The VisibleColumns collection of the TableDescriptor is auto-populated from the Columns collection and all the columns in that collection are automatically added to the VisibleColumns collection. Clicking on the VisibleColumns property of the Grid''s TableDescriptor launches the GridVisibleColumnDescriptor Collection Editor, where the column names of the columns that need to be displayed can be added or removed. to do this in code. [vb] Me.GridGroupingControl1.TableDescriptor.VisibleColumns.Remove("ColumnName") Adding a Hyperlink column to grid control: ------------------------------------------ It''s possible to add a hyperlink column as like in normal ASP.NET grid control using Item Template. please have a look at our Formatting/Portfolio sample that ships with our Essentialgrid Install which uses Hyperlink column as templates. Also please look in to this KB which explains this in detail. Hope the above suggestions should help you a good start with our grid. Let us know if you have any more queries Best Regards, A.Sivakumar.


AD Administrator Syncfusion Team June 30, 2006 01:12 AM UTC

Hi Manoj, We have attached a sample with the following specifications: a) The grid is binded to the ''products'' table in the ''Nwind'' DataBase that ships with our ''Essential Grid'' install and points to the ''Syncfusion''virtual directory. b) An Unbound column ''Total'' is added dynamically and we fill this column calculating the ''total price'' for the ''existing stocks'' by handling the ''''QueryValue'''' event. c) You can show/hide the ''SupplierID'' column by clicking the button placed below the grid. d) The Hyperlink is added as a Item template for the ProductID column. By clicking the hyperlink column it goes to the appropriate '' Grid forums'' page Note:if you are not using 4.2.0.37 version you will have to change the Version numbers appropriately in the register tags. Thanks, Suresh

Forum45833.zip


MS manoj singh June 30, 2006 06:33 AM UTC

Hi Siva / Suresh , Thanks for your help, i would like to know do we have anything in like "OnItemDataBound" event with Syncfusion grid control as we have in ASP.NET grid control so that we can changes the grid value while they are populating. On similer line to this, do we have anything like "<%#DataBinder.Eval(Container.DataItem, "ReportName")%>" Function which will help me in displaying datavalue directly in my ItemTemplate Column. Thanks again for your help. Regards, Manoj Singh.


AD Administrator Syncfusion Team June 30, 2006 09:41 PM UTC

Hi Manoj, You can handle the ''QueryCellStyleInfo'' event to change any value of any cell in our grid based on your conditions. You can check for the record rows inside this and can change the value. To display the datavalue directly in your ItemTemplate Column can be done by using the "Container.StyleInfo.Text" in the aspx .Please have a look at our Templates/CustomTemplatedAppearance sample that ships with our ''EssentialGrid'' install which illustrates this. Alternatively you can also see this sample in our Essential Studio 4.2 Online Demo: Regards, A.Sivakumar


TO Tomio April 5, 2011 02:05 PM UTC

Hi, I'd like to hide a column in the Grouping Grid Control, but I will need the values contained in this column.
How do I hide and then fetch the value of hidden column?
Thanks



RR Ranjithkumar R G Syncfusion Team April 6, 2011 10:54 AM UTC

Hi Tomio,

Thanks for your interest in Syncfusion products.

We have provided response to your query in forum 98855

Could you please refer the below link for your query and follow up in the below forum.

http://www.syncfusion.com/support/forums/general/98855

Please let us know your concerns.

Regards,
Ranjithkumar.




TO Tomio April 13, 2011 03:02 PM UTC

Hi, I wanted to know how to tell if the line is grouped in una normal when checked in GridGroupingControl in VB.NET? Thanks




RR Ranjithkumar R G Syncfusion Team April 15, 2011 02:49 PM UTC

Hi Tomio,

Thanks for using Syncfusion products.

We have provided response to your query in forum 98989

Could you please refer the below link for your query and follow up in the below forum.

http://www.syncfusion.com/support/forums/general/98989

Please let us know your concerns.

Regards,
Ranjithkumar.


Loader.
Live Chat Icon For mobile
Up arrow icon