General information
Category:
The Mere Mortals .NET Framework
Title:
Binding a datagrid's tablestyle to dataview
Environment versions
Network:
Windows 2003 Server
Hi all,
Answer :
Set the TableStyle mapping name to be the name of the DataTable that the DataView is based on.
Revised question :
How do you map a TableStyle onto a DataView? The reason I need a DataView is so I can easily filter the rows, and the reason I need a TableStyle is so I can hide some of the columns in the DataView and also reuse/borrow the "find row in datagrid" code from the mmPickerForm (it needs a tablestyle defined on the grid otherwise it will not work).
Thanks in advance,
Andrew
Old and overly verbose question :
I am having a problem databinding a dataview to a mmDataGrid's TableStyle. It works when I bind the dataview directly onto the mmDataGrid's BindingSourceMember (not using any tablestyles on the datagrid). It then shows all the columns and rows in the dataview, but I would like to limit the columns that are shown (I need some of the columns such as the primary key column though so I can't just remove the columns in the dataview).
The problem is occurs when I try to bind the same dataview to a TableStyle. The mmDataGrid then shows no columns or data at all. I use exacty the same dataview name to bind the dataview directly onto the business object (this works) as when I bind to the TableStyle (this does not work).
Some background :
There are two "get data" methods fired on the same business object at the form's constructor (after the InitializeComponent() call).
Both of these "get data" methods grab data from the database and put it in their separate tables (uses fillDataSet() with an sql statement). The first method that is fired fills the default table (which has no dataview), the second fills another table, it is this table that the dataview is based on.
The dataview is created in an overriden version of the business object's HookPostGetData().
As always, any help is greatly appreciated,
Andrew
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only