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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

71389 Jan 29,2008 09:53 AM Feb 1,2008 01:34 PM Windows Forms 3
loading
Tags: GridControl
harisan
Asked On January 29, 2008 09:53 AM

Hello,

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,
Harry


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

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];
Console.WriteLine(column.FieldDescriptor.GetPropertyType());
}
}


Please let me know if you have any questions.

Regards,
Vinoth



harisan
Replied On February 1, 2008 07:56 AM

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(col.MappingName)
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?

Thanks,
Harry


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

Hi Harry,

Please follow the below forum thread for more details.
http://www.syncfusion.com/support/forums/message.aspx?&MessageID=71382

Best regards,
Vinoth


CONFIRMATION

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.

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.

;