I am binding a datatable to a WinForms grid control but for some reason the
GridTableStyle is being ignored, the data just displays as if no TableStyle
was set up
I have also tried changing the DataTable TableName in code before the code
below - no effect.
The data displayed is correct, just the formatting is wrong
SubAreasAtDate is a DataTable and dgLicensedBlocks is the data grid
hear are the two lines:-
dgLicensedBlocks.DataSource = SubAreasAtDate
dgLicensedBlocks.TableStyles(0).MappingName = SubAreasAtDate.TableName
I have also tried:-
dgLicensedBlocks.DataSource = SubAreasAtDate
dgLicensedBlocks.TableStyles.Clear()
dgLicensedBlocks.TableStyles.Add(Me.DataGridTableStyle2)
dgLicensedBlocks.TableStyles(0).MappingName = SubAreasAtDate.TableName
Equivalent code works fine on 8 other datagrids in the app.
any ideas?
guy
Ken Tucker [MVP] - 25 Oct 2004 19:47 GMT
Hi,
The little code you show looks ok. Are you sure you are loading the
right tablestyle?
Ken
---------------
I am binding a datatable to a WinForms grid control but for some reason the
GridTableStyle is being ignored, the data just displays as if no TableStyle
was set up
I have also tried changing the DataTable TableName in code before the code
below - no effect.
The data displayed is correct, just the formatting is wrong
SubAreasAtDate is a DataTable and dgLicensedBlocks is the data grid
hear are the two lines:-
dgLicensedBlocks.DataSource = SubAreasAtDate
dgLicensedBlocks.TableStyles(0).MappingName = SubAreasAtDate.TableName
I have also tried:-
dgLicensedBlocks.DataSource = SubAreasAtDate
dgLicensedBlocks.TableStyles.Clear()
dgLicensedBlocks.TableStyles.Add(Me.DataGridTableStyle2)
dgLicensedBlocks.TableStyles(0).MappingName = SubAreasAtDate.TableName
Equivalent code works fine on 8 other datagrids in the app.
any ideas?
guy
Dennis - 26 Oct 2004 00:05 GMT
Have you checked the mappnig names of your DataGridColumnStyles to be sure
they reflect the names of fields in the DataTable? You didn't show your code
for setting up these and adding them to the TableStyle Collection.
> I am binding a datatable to a WinForms grid control but for some reason the
> GridTableStyle is being ignored, the data just displays as if no TableStyle
[quoted text clipped - 21 lines]
>
> guy
guy - 26 Oct 2004 12:57 GMT
Thanks all,
i put a handler on the mappingname changed event and found another bit of
code was butting in and changing it
guy
> I am binding a datatable to a WinForms grid control but for some reason the
> GridTableStyle is being ignored, the data just displays as if no TableStyle
[quoted text clipped - 21 lines]
>
> guy