Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Binding a datagrid's tablestyle to dataview
Message
From
23/05/2005 08:44:59
 
 
To
All
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Binding a datagrid's tablestyle to dataview
Environment versions
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01016692
Message ID:
01016692
Views:
75
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
Map
View

Click here to load this message in the networking platform