473,386 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Sort a datagrid without the help of SQL server

Hi,

Is there a way to sort a datagrid without the help of SQL server? I usually
use ADO.Net to get a dataset from SQL sever then bind it to datagrid. Now I
am asked to make datagrid support sorting, of course I can change my SQL
statements by adding order by clause for sorting purposes. But I would like
to know if there are other options.

TIA
Nov 19 '05 #1
5 1866
Surely there is a simple way. Using DataView will overcome this issue.
DataTable's View property will give a valid DataView. DataView's Sort
expression works similar to SQL. It accepts an order by string. Simply you
can write "PKID ASC, UserID DESC, ActionDate ASC".

--
Thanks,
Yunus Emre ALPÖZEN
"Ed Chiu" <Ed****@discussions.microsoft.com> wrote in message
news:20**********************************@microsof t.com...
Hi,

Is there a way to sort a datagrid without the help of SQL server? I
usually
use ADO.Net to get a dataset from SQL sever then bind it to datagrid. Now
I
am asked to make datagrid support sorting, of course I can change my SQL
statements by adding order by clause for sorting purposes. But I would
like
to know if there are other options.

TIA

Nov 19 '05 #2
Use a DataView.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Ed Chiu" <Ed****@discussions.microsoft.com> wrote in message
news:20**********************************@microsof t.com...
Hi,

Is there a way to sort a datagrid without the help of SQL server? I
usually
use ADO.Net to get a dataset from SQL sever then bind it to datagrid. Now
I
am asked to make datagrid support sorting, of course I can change my SQL
statements by adding order by clause for sorting purposes. But I would
like
to know if there are other options.

TIA

Nov 19 '05 #3
http://www.daveandal.net/books/8900/...-datagrid.aspx

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:Oi**************@TK2MSFTNGP14.phx.gbl...
Use a DataView.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Ed Chiu" <Ed****@discussions.microsoft.com> wrote in message
news:20**********************************@microsof t.com...
Hi,

Is there a way to sort a datagrid without the help of SQL server? I
usually
use ADO.Net to get a dataset from SQL sever then bind it to datagrid. Now I
am asked to make datagrid support sorting, of course I can change my SQL
statements by adding order by clause for sorting purposes. But I would
like
to know if there are other options.

TIA


Nov 19 '05 #4


İt is my opinion there is a simple way. You can Use DataView
DataTable's View property will give a valid DataView. DataView's Sort
Simply you
can write " ASC or DESC".
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #5


İt is my opinion there is a simple way. You can Use DataView
DataTable's View property will give a valid DataView. DataView's Sort
Simply you
can write " ASC or DESC".

Yener Türkeli
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Webgour | last post by:
Hi, I'm tring to add a column to a datagrid with a linkbutton as header that can be used to sort the column. The column and the linkbutton are added programmatically (see below). However the...
2
by: Mark | last post by:
Assume you have a strongly typed collection of a class called Person. The strongly typed collection implements IEnumerable so it can be databound to a server control like a DataGrid. The Person...
7
by: DC Gringo | last post by:
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 DataGrid1_SortCommand: -------------------- Private...
2
by: Yanir | last post by:
H I have to display a sortable list of columns(a table or so) - by click on the title of a column, the column would be the criteria to sort by I know datagrid is very conveniant, but I want to save...
4
by: bep | last post by:
Hello What is the best way to sort an XmlDocument for display in a DataGrig? I can use Xpath with an XpathExpression, and a XpathNavigator. But this XpathNavigator object is of no use to me, I...
1
by: Gunjan Garg | last post by:
Hello All, I am working to create a generic datagrid which accepts a datasource(ListData - This is our own datatype) and depending on the calling program customizes itself for sorting,...
4
by: Joe | last post by:
Hello, I have a datagrid in an nested html table (one table inside of another table) and have set the allowsSorting property to true. I've created in the code-behind a method (Sub - I'm using...
4
by: Jeff User | last post by:
Hi I tryed to solve this problem over in the framework.asp group, but still am having trouble. Hope someone here can help. using .net 1.1, VS 2003 and C# I have an asp.DataGrid control with a...
4
by: G .Net | last post by:
Hi I have a question which I hope you can help with. I am setting the DataSource of a DataGrid to be a DataView. I am sorting the DataView by various fields which include a Date. When I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.