Re: can not set the tablestyles to a data grid by Norman
Norman
Thu Nov 27 11:16:10 CST 2003
The simplest way, of course, is set DataGrid's TableStyle in Properties
window: click "TableStyles" property to add as many TableStyles as you want.
That means a sigle DataGrid can be bound to different datasource (Tables)
without extra configuration other than TableStyle. In each TableStyle, then,
you define GridColumnStyle for each column of the DataGrid, mapped to a
column in DataTable. You can also configure TableStyles/GridColumnStyles in
code programmingly.
Say, if your DataSet has to tables: "Table1" and "Table2". You can add two
TableStyles, mapping to "Table1" and "Table2" respectively. So, if in your
code, you do
DataGrid1.DataSource=MyDataSet
DataGrid1.DataMember="Table1"
The DataGrid will show the look as the TableStyle, mapped to "Table1",
defined. And later you may want to display data in "Table2", you simply do:
DataGrid1.DataSource=MyDataSet
DataGrid1.DataMember="Table2"
The DataGrid's look will change according to the definition of the other
TableStyle.
"Cyrus" <CyrusChiu@kfsolution.com> wrote in message
news:%23BbvLhJtDHA.1224@TK2MSFTNGP09.phx.gbl...
> i defined a dataset and set it instance as the data source of the data
grid
> but i cannot find the mapping name of the table of this dataset inside the
> tablestyle property, i dont know how to set the style
>
>