>How can I get views created in a HookPostGetData method?
>I need it to create a lookup combobox in the mmGridControl based on DevExpress control. The following code works fine:
>
>repositoryItemLookUpEdit1.DataSource = dsShipper.Tables[0].DefaultView;
>
>I can create a view, set a filter I need and use it as a DataSource, but I want to use views that I created in the business object.
You can retrieve a DataView you have created by using mmDataSet's GetDataView method. Here are the three overloads of this method:
- Returns the specified DataView from the DataSet's table zero (0)
public virtual DataView GetDataView(string dataViewName)
Public Overridable Function GetDataView(dataViewName As String) As DataView
- Returns the specified DataView from the specified DataTable
public virtual DataView GetDataView(string dataViewName, string tableName)
Public Overridable Function GetDataView(dataViewName As String, tableName As String) As DataView
- Returns the specified DataView from the specified DataTable number
public virtual DataView GetDataView(string dataViewName, int tableNum)
Public Overridable Function GetDataView(dataViewName As String, tableNum As Integer) As DataView
Here's an example showing how to get a table's default view for the Orders DataTable.
In C#:
DataView dv = ds.GetDataView("DefaultView", "Orders");
In VB .NET:
Dim dv As DataView = ds.GetDataView("DefaultView", "Orders")
Here's an example showing how to get a DataView named dvUsersByID from the Users table.
In C#:
DataView dv = ds.GetDataView("dvUsersByID", "Users");
In VB .NET:
Dim dv As DataView = ds.GetDataView("dvUsersByID", "Users")
Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com