B
Bill Todd
I have a simple Web app using the Northwind database. I have a typed
dataset that contains the Suppliers and Products tables. I need to
sort and filter the Products table. For reasons that are irrelevant to
this problem I cannot use a DataView component.
My WebForm contains the following code, however, after this code
executes the Product records in the DataGrid are not sorted by
ProductName. I have also tried setting the DataView's RowFilter
property and that does not work either. There are no error messages.
private DataView productDataView;
productDataView = northwindDataSet1.Tables["Products"].DefaultView;
productDataView.Sort = "ProductName";
productGrid.DataBind();
The properties of the DataGrid are:
DataSource = northwindDataSet1
DataMember = Products
DataKeyField = ProductId
I have also tried the following version of the code without success.
private DataView productDataView;
productDataView = northwindDataSet1.Tables["Products"].DefaultView;
productDataView.Sort = "ProductName";
productGrid.DataSource = productDataView;
productGrid.DataBind();
What do I have to do to get the DefaultView to work?
Thanks.
dataset that contains the Suppliers and Products tables. I need to
sort and filter the Products table. For reasons that are irrelevant to
this problem I cannot use a DataView component.
My WebForm contains the following code, however, after this code
executes the Product records in the DataGrid are not sorted by
ProductName. I have also tried setting the DataView's RowFilter
property and that does not work either. There are no error messages.
private DataView productDataView;
productDataView = northwindDataSet1.Tables["Products"].DefaultView;
productDataView.Sort = "ProductName";
productGrid.DataBind();
The properties of the DataGrid are:
DataSource = northwindDataSet1
DataMember = Products
DataKeyField = ProductId
I have also tried the following version of the code without success.
private DataView productDataView;
productDataView = northwindDataSet1.Tables["Products"].DefaultView;
productDataView.Sort = "ProductName";
productGrid.DataSource = productDataView;
productGrid.DataBind();
What do I have to do to get the DefaultView to work?
Thanks.