Sorting DropDownList In .NET 2.0 Databinding

S

Simon Gregory

I am currently attempting to figure out how the new databinding
stucture works in ASP.NET 2.0 after working with v1.0 & v1.1 for
several years.

It seems that if you wish to do set up databinding at Design Time, you
are restricted to using one of the 5 xxxDataSource controls.

The data in our websites are usually obtained via a set of webservices
and are contained in a set of strongly typed relational DataSets.

In this case, the ObjectDataSource seems to be the control I need to
use, but it seems to have a high number of restrictions, especially in
relation to sorting the basic databound controls, such as the
DropDownList control.

In ASP.NET 1.0 & 1.1, all I needed to do to be able to databind these
controls to the respective dataset table (or data subset), was drop a
DataView control on the page and set the filter & sort parameters
respectively at design or runtime. However, it doesn't seem possible to
use the DataView as a design time control in 2.0.

In ASP 2.0, the ObjectDataSource is all that is available to act as a
binding layer between the control and the dataset, however there seems
no way to be able to set the sort with this control at design time.
Does this mean that we are now expected to hard code different methods
in the data layer to provide all the various sorting combinations for
each table that an entire site would need?!?

When using some of the other new controls (such as the GridView), you
can get it to easily instuct the ObjectDataSource to sort the undelying
DataTable by either enabling the AllowSorting property and let the user
select it or use the (runtime) Sort method - although this too
prohibits defining the Sorting at design time - but at least it's
possible to achieve fairly simply. The DropDownList control doesn't
even support a sort method which is both restrictive and seemingly
inconsistent!

Surely I'm mssing something here, I thought 2.0 was supposed to make
databinding easier.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top