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
VK
Vinoth Kumar K
Syncfusion Team
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];
Console.WriteLine(column.FieldDescriptor.GetPropertyType());
}
}
Please let me know if you have any questions.
Regards,
Vinoth
HA
harisan
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(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