Solved

default sort order in gridview at Vb.net

Posted on 2014-09-08
3
579 Views
Last Modified: 2014-09-08
Hi Expert,

I have a student gridview, how I can set defualt sort by firstname, lastname and City ...

click header sort works fine, it can sort Asending or descending. I only have problem in default sort when first time load gridview.


Thanks in advance.
0
Comment
Question by:dshi15
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 40

Accepted Solution

by:
Kyle Abrahams earned 400 total points
ID: 40310706
From:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.sort(v=vs.110).aspx


  myGridView.Sort("FirstName, LastName, City", SortDirection.Ascending);
0
 
LVL 40

Assisted Solution

by:Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger) earned 100 total points
ID: 40311188
Do you fill your grid from a database?

If so, simply set the Order By clause of the query / view / stored procedure that you use to fetch the data to the fields on which you want to sort them, something like:

SELECT * FROM YourTable ORDER BY firstname, lastname, City
0

Featured Post

Business Impact of IT Communications

What are the business impacts of how well businesses communicate during an IT incident? Targeting, speed, and transparency all matter. Find out more in this infographic.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question