M
Mark Travis
Hi all,
I have written a simple Web Application that displays a query result onto a
page using the ASP DataGrid.
To Digress
=======
Development information about the page is as follows
1. The database used is SqlServer 2000.
2. A Stored Procedure is dragged onto the page from the Server Explorer
creating a connection and command object.
3. An adapter object is dragged onto the page from the Toolbox and the
SelectCommand property is assigned the command object generated in step 2
4. A dataset object is created from the adapter object
5. In the page load, the relevent Adapter.Fill(dataset) and Grid.ReBind()
functions are called.
The above leads to a web page that displays the information retrieved by the
Stored Procedure.
The Problem
=========
I have attempted to add sorting to the Grid. I have selected what is
required to receive the Grid_SortCommand event in my page object and the
e.SortExpression is returning the name of the field selected but any
attempts to sort the data based on the SortExpression fails.
The line I am using to sort is
Dataset.Tables(0).DefaultView.Sort = e.SortExpression
This is run after the dataset has been filled by the adapter but before the
grid is rebinded to the dataset.
The Question(s)
===========
Can a grid be sorted when it is populated by a Stored Procedure? (cringe if
this is so)
Or; Have I failed to take something fundamental into account?
All the examples I have found work with dynamically created
dataviews/datatables.
Any help would be greatly appreciated.
Thanks in advance.
Mark
I have written a simple Web Application that displays a query result onto a
page using the ASP DataGrid.
To Digress
=======
Development information about the page is as follows
1. The database used is SqlServer 2000.
2. A Stored Procedure is dragged onto the page from the Server Explorer
creating a connection and command object.
3. An adapter object is dragged onto the page from the Toolbox and the
SelectCommand property is assigned the command object generated in step 2
4. A dataset object is created from the adapter object
5. In the page load, the relevent Adapter.Fill(dataset) and Grid.ReBind()
functions are called.
The above leads to a web page that displays the information retrieved by the
Stored Procedure.
The Problem
=========
I have attempted to add sorting to the Grid. I have selected what is
required to receive the Grid_SortCommand event in my page object and the
e.SortExpression is returning the name of the field selected but any
attempts to sort the data based on the SortExpression fails.
The line I am using to sort is
Dataset.Tables(0).DefaultView.Sort = e.SortExpression
This is run after the dataset has been filled by the adapter but before the
grid is rebinded to the dataset.
The Question(s)
===========
Can a grid be sorted when it is populated by a Stored Procedure? (cringe if
this is so)
Or; Have I failed to take something fundamental into account?
All the examples I have found work with dynamically created
dataviews/datatables.
Any help would be greatly appreciated.
Thanks in advance.
Mark