Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
Bill Todd #1
Cannot sort DataGrid using DefaultView?
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.
--
Bill
Bill Todd Guest
-
sort in datagrid
Hi, I have some columns in my datagrid which are date type. I want to sort on them. What would be the best way to do it. Based on a article to... -
Sort datagrid
Hello Group, I have a datagrid which needs to be sorted but the column headers should not be clickable on certain conditions( say on the "print... -
Datagrid sort
I have a datagrid that sorts. The sort doesn't seem to execute on my template column. It only works on my bound columns. -
datagrid won't sort
I have a datagrid that won't sort. The event handler is firing and return label text, just not the sort. Here's my Sub Page_Load and Sub... -
Ado sort error-Ado Sort -Relate, Compute By, or Sort operations cannot be done on column(s) whose key length is unknown or exceeds 10 KB.
Ado Sort -Relate, Compute By, or Sort operations cannot be done on column(s) whose key length is unknown or exceeds 10 KB. hi, guys i have asp...



Reply With Quote

