开发者

Default column sorting from datagrid

I ha开发者_开发问答ve 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!!


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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜