473,569 Members | 2,762 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1875
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****@discuss ions.microsoft. com> wrote in message
news:20******** *************** ***********@mic rosoft.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****@discuss ions.microsoft. com> wrote in message
news:20******** *************** ***********@mic rosoft.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.ne t> wrote in message
news:Oi******** ******@TK2MSFTN GP14.phx.gbl...
Use a DataView.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Ed Chiu" <Ed****@discuss ions.microsoft. com> wrote in message
news:20******** *************** ***********@mic rosoft.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
8900
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 problem is that when you click the added column header it doesn't trigger the sort. The code : <%@ Page language="c#"...
2
2054
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 class has several public properties like FirstName, LastName, and Gender. What steps would it take to allow the collection to be sorted in multiple...
7
2432
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 Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here
2
324
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 the round trip to the server(I don't want postback) Is there other way to use ASP.NET server controls(maybe the datagrid itself) to have an easy...
4
2177
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 need a XmlDocument. So is there an easy way to convert an XPathNavigator object to an XmlDocument? And I could use a piece of Xstl to transform...
1
2684
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, paginantion or accepting the add and remove item events. What i am observing is that none of the vents are happening... (Sort, page, or item). I am sure I...
4
1507
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 VB.NET) that handles the SortCommand event of the data grid. I've included the declaration of the Sub below. EnableViewState is set to false; we...
4
2118
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 Delete button on the end of each row. I am unable to gain access to the event when the button is clicked. I don't fully understand how the click...
4
1537
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 create a new row in the DataGrid and set the date to me within the current sort range, the newly created row "jumps" to its correct position in the...
0
7694
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7921
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.