tags:

views:

11

answers:

1

I have 5 bound columns to be retrieved from the database but I want that on page load event the retrieval of data should be sorted according to that column only,

What I need to do..plz help me!!

+3  A: 

I'd recommend having the data sorted for you by the database. I presume you have a database query somewhere - either in the ASP.NET page, in a stored procedure, or in your object model - what you need to do is specify an ORDER BY clause.

For example, if you have the following SQL statement used to populate your DataGrid:

SELECT Col1, Col2, Col3, Col4, Col5
FROM MyTable

And you want the results sorted by, say, Col3, use the following query instead:

SELECT Col1, Col2, Col3, Col4, Col5
FROM MyTable
ORDER BY Col3

Happy Programming!

Scott Mitchell