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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get DataType for each ggc column to validate user input

Thread ID:





71389 Jan 29,2008 02:53 PM UTC Feb 1,2008 06:34 PM UTC WinForms 3
Tags: GridControl
Asked On January 29, 2008 02:53 PM UTC


Please advise me how to get DataType if we populate ggc from dataset, in order that we can customize text alignment, validate user input in each column of each table?
P.S. There are visible columns removed.

Thanks and Best Regards,

Vinoth Kumar K [Syncfusion]
Replied On January 30, 2008 10:40 PM UTC

Hi Harry,

Thanks for using Syncfusion Products.

You can get the DataType of each column in GridGrouping Control by using the following code.Please refer to the code given below:

private void button1_Click(object sender, EventArgs e)
for (int i = 0; i <= 4; i++)
GridColumnDescriptor column = this.gridGroupingControl1.TableDescriptor.Columns[i];

Please let me know if you have any questions.


Replied On February 1, 2008 12:56 PM UTC

Hi Vinoth,

Thanks for your assit, this code works but the problem is that: it got wrong column index reference due if there is any visible column(s) removed.

However I got advise from Haneef to implement this code:
Private Sub gridGroupingControl1_TableControlCellClick(ByVal sender As Object, ByVal e As GridTableControlCellClickEventArgs)
Dim cm As CurrencyManager = e.TableControl.Table.GetCurrencyManager()
Dim dv As System.Data.DataView = cm.List

If Not dv Is Nothing Then
Dim col As GridColumnDescriptor = e.TableControl.Table.GetColumnDescriptorAt(e.Inner.RowIndex,e.Inner.ColIndex)
If Not col Is Nothing Then
Console.WriteLine( dv.Table.Columns.Contains(col.MappingName) )
End If
End If
End Sub

The problem is I got InvalidCastException error on this line:
Dim dv As System.Data.DataView = cm.List

Please advise me how to fix it?


Vinoth Kumar K [Syncfusion]
Replied On February 1, 2008 06:34 PM UTC

Hi Harry,

Please follow the below forum thread for more details.

Best regards,


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon