DropDownlist and sorting

A

abcd

I am using DropdownList control and it is popued up by my datareader

How can I sort the items...neither DropDownlist non data reader has sort
method

lstTitleList.DataSource = myReader;
lstTitleList.DataTextField = "Title";
lstTitleList.DataValueField = "Value";
lstTitleList.DataBind();

thanks
 
A

abcd

got it solved using DataSet and DataView.

It looks that DataReader is forwardonly and there is no facility for
sorting...

thanks
 
T

Teemu Keiski

Unless you do the sort in the SQL query itself. But if you need to swith the
order (user-defined sorting, and more than one column), then using
DataView/DataSet is ok because you don't have to pass the sort info so much
to the database.

On the other hand it *is*doable with dataReader as well (getting dataSet etc
always adds little overhead, though it also can bring performance in terms
of caching and so on
 

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

Forum statistics

Threads
473,787
Messages
2,569,630
Members
45,338
Latest member
41Pearline46

Latest Threads

Top