473,385 Members | 1,912 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,385 software developers and data experts.

2.0 GridView .. Sorting Question


Ok, I've gotten somewhat handy with the new GridView.
And I have it bound to a business object datasource, via the
ObjectDataSource.

Lets say I have 3 databound columns
EmpID, LastName,FirstName

I have it working where.... If I click the Header, that it will sort based
on the Header I click.
I even have DESC working if they click the same column header twice.

...

Now, let's say I want to NOT use the Headers. I want to setup 3 ddl (drop
down lists) ...something like this:

Sort By: LastName
(then by): FirstName
(then by): EmpID

And then sort the data.....so I get a sort string like this
"LastName,FirstName,EmpID"

To add some more info, lets say I have 450 employees, and my pagesize/count
is set to 100.
(Aka, 5 pages of data..to hold 100,100,100,100, and 50 employees)
My example is trivial, my data is more complicated than this, fyi.

Which/What object handles the sorting from then on out?

I specifically have a strongly typed DataSet as my source for my
ObjectDataSource, because I didn't want to write a super complicated
IComparer.

Can I sort the dataset.... then rebind it to the ObjectDataSource?

Aka, how can I sort when I want to setup the sort ..outside of the GridView
itself.

....

Thanks.


Feb 17 '06 #1
1 1131
the way I do it with datagrids in 1.1, is from the dataset i get
defaultview:

DataView dv = DataSet.DefaultView;

then you can do a dv.Sort

in your gridview OnSort, get the dataview, sort it and re-bind it to
the gridview. you can also supply multiple sort options in the dataview
like you mentioned: LastName,FirstName,EmpID

this might be different for the GridView, I havent played with that
control yet, so you get the idea.

Feb 17 '06 #2

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

Similar topics

0
by: ck388 | last post by:
For some reason when I enable the callback feature of the gridview I still get a page refresh, that is it seems like there is a postback that occurs, not a callback which is just supposed to update...
1
by: ck388 | last post by:
For some reason when I enable the callback feature of the gridview I still get a page refresh, that is it seems like there is a postback that occurs, not a callback which is just supposed to update...
4
by: =?Utf-8?B?R2VyaGFyZA==?= | last post by:
I have a vb.net 2.0 app that is loading a GridView with a DataSource that is returned from a function. The definitions in the function are: Dim ReportDS As DataSet = New DataSet Dim...
3
by: =?Utf-8?B?YmJkb2J1ZGR5?= | last post by:
I have a question that maybe somebody can help me out. I have a gridview that is bound to a sqltable, and I have created two template columns. I am having problems getting the sorting to work....
1
by: idan | last post by:
Here's my data: (Table: EmployeePlan) EmpID Plan Status abc123 PlanA A abc123 PlanB D abc123 PlanC A xyz789 PlanA D xyz789 PlanB D xyz789 PlanC...
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
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
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,...
0
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...
0
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,...
0
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...

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.