Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 8th, 2006, 02:23 PM
Registered User
 
Join Date: Dec 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sort with gridview

Hello,
I have been trying to get this to work now for 2 days and I must be missing something cause I don’t think it should be this hard. I have a gridview that I fill without using a datasourceid. All I want to do is be able to sort the columns however the user wants to. I have been able to find C code that helps but no examples with VB. I have got as far as being able to get to the sub gridView_Sorting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSortEventArgs) but cant get past this point. Can anyone please give me a hint or send me to a good example on the web.
Thanks

 
Old December 9th, 2006, 09:17 AM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi
there are lots of ways when u want to display the datacolumns in grid in sorted form
i want to know what actually u are using my mean to bind the datagrid with the columns of a table you are using templates or you are using <asp:boundcolumns>
if u are using bound column then it have its property SortExpression which we can use like
<asp:BoundColumn datafield="nameofcolumn" sortexpression="nameofcolumn which u want to use as sort expression"/>
if u will use above data will be displayed in sorted order.

secondly in a query which u are using to retrieve the data as select query apply order by clause at last. by this select query will generate the result in sorted order and grid will also after that

if u are using item templates then u can write a program i will write if u need



thanks......





Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView - initial load and sort direction snufse ASP.NET 2.0 Basics 0 October 30th, 2008 08:20 PM
[2005] GridView sort problem snufse ASP.NET 2.0 Basics 7 February 12th, 2008 10:26 AM
GridView Sort (Top Urgent ) msbsam ASP.NET 2.0 Professional 0 December 6th, 2006 02:34 AM
GridView sort without DataSet? drasko ASP.NET 2.0 Professional 1 October 3rd, 2006 06:57 AM
how to sort cross tab.sort based on row total joxa83 Crystal Reports 7 March 2nd, 2006 09:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.