[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 473
  • Last Modified:

2.0 Object Data Source -Sort

1st. Is the new object data easier for you guys? Its new to me, so its making my head hurt. I feel like its harder to use then the 1.1 sa, ds, and dv. (In regards to doing custom binding. aka I change data as it comes down from the sql server.)

But anyways on to the question at hand.

So, like I stated - I change data as I pull it from the SQL Server. Example, some things come down as 71206 and I would change that to 7/12/2006.
Thats all fine and great. In 2.0, I approach this by pointing my object DS to a function that returns a typed data set. And that works great. It binds to a grid view and theres my data. Now heres where I have the problem. And I bet this is an easy one. How in the world do I call the sort routine on the data. I want a default sort on the data. In 1.1 I would just through a dv in there and it would be done. I can't do this at the SQL level, nor do I want to do it in the function as then I would return a dv and there would go all my nice UI for the databound items. I know the 2.0 control can sort as I can do it via the gv as the app is running, but how do  I call it in the code behind? What am I missing. I want to use this data-sorted in a dropdownlist also, so sorting on the grid only would not work.

2 Solutions
Sammy AgeilCommented:
This may help you with what you looking for.
download the example to see the full source code
Good luck
Bob LearnedCommented:
Download what example?

Jojo1771Author Commented:
A link to an example would be nice. But I have looked at almost every example in msdn, it seems like.

To restate my question

How do I sort the data in a Object Datasource, with out having to do a manual sort at the function level (aka passing the sort parameter)?
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

I believe the answer is "You can't", the ObjectDataSource control doesn't actually sort the data unless you are returning a DataSet or DataTable, they just send the sort information you and databound controls send them to the underlying database, and that is actually what sorts the data.

Check out what is said here about this, about halfway down the page,
Sammy AgeilCommented:
Sorry Jojo,
I missed the most important thing in my post and that was the link

Jojo1771Author Commented:
I have read both of these sites already, and have finally given up and did the sort in my function like all the examples show. So i must agree with raterus and say its not possible.


Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now