Solved

default sort order in gridview at Vb.net

Posted on 2014-09-08
3
484 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
3 Comments
 
LVL 39

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

705 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now