473,385 Members | 1,359 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.

How-To Sort a Dropdownlist

gj
Hi,

I'm trying to sort a dropdownlist. I tried using .Sort but that
doesn't work. can anyone help me? Below is the code for creating the
list.

foreach (DataRow quizRow in dsMain1.Tables["Quiz"].Rows)

{

ListItem newquiz= new ListItem();

newquiz.Text=quizRow["Quiz_Name"].ToString().Trim();
newquiz.Value=quizRow["Quiz_ID"].ToString().Trim();
drpSelectQuiz.Items.Add(newquiz);
} //end foreach loop

Thanks
Nov 16 '05 #1
1 3645
gj,

Why are you adding the items manually? Why not bind the list to the
data set directly?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"gj" <jo****@boystown.org> wrote in message
news:4f**************************@posting.google.c om...
Hi,

I'm trying to sort a dropdownlist. I tried using .Sort but that
doesn't work. can anyone help me? Below is the code for creating the
list.

foreach (DataRow quizRow in dsMain1.Tables["Quiz"].Rows)

{

ListItem newquiz= new ListItem();

newquiz.Text=quizRow["Quiz_Name"].ToString().Trim();
newquiz.Value=quizRow["Quiz_ID"].ToString().Trim();
drpSelectQuiz.Items.Add(newquiz);
} //end foreach loop

Thanks

Nov 16 '05 #2

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

Similar topics

4
by: Tom Szabo | last post by:
Just wandering how can you close a browser remotely. In some web applications the browser closes or refreshes periodically. How is that done and how can it be done through PHP? TIA, Tom
15
by: Reid Nichol | last post by:
Hello, I was wondering if I could control how many bytes are in an int and the byte order. In C/C++ I can use int32 but how do I do this in python? How can I control byte order?
0
by: v I n O | last post by:
hI Geeks Please do let me know how do i find how many instances sql server running on the single machine. or in the n/w my objective should with help of C#/vb.net
4
by: James Salisbury | last post by:
Hi, I was checking my parent's website salisbury.cabrera.net on google by entering villa rent spain cabrera I can see the required site, ranked at 4, but I am concerend by the return at 1 and 5...
2
by: Frances Del Rio | last post by:
http://www.emol.com/especiales/cocina_chilena/comida.asp this page is so neat (goes in pop-up..) how was this done? how do you give a layer (or div, I guess) a semi-transparency so you can still...
4
by: | last post by:
Developing, building, and testing. How do it the best? Learning from the world leader - Microsoft I'm very interested in how the developing/build/testing workflow @ Microsoft looks like. I...
4
by: Supra | last post by:
in vb6 listbox1.remove item 5 how will i do in vb.net? regards
7
by: anushhprabu | last post by:
#define q(k)main(){ return!puts(#k"\nPRABUq("#k")");} q(#define q(k)main(){return!puts(#k"\nq("#k")");}) guys i'm working on this code.. i got it fromnet.. how this is working.. anyone pls.....
0
by: candra | last post by:
Learn What Hackers Know? -General Hacking Information -Password Security -Scanning, Fingerprinting And Similar Techniques -How Hackers Attack Numerous Internet Services -How Hackers Attack Web...
2
by: belred | last post by:
i just read this blog about how many objects (types) are loaded for a hello world program in C#. http://blogs.msdn.com/abhinaba/archive/2008/09/15/how-many-types-are-loaded-for-hello-world.aspx ...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.