Second Super Simple Question (Which I cant get!)

B

Badass Scotsman

Hello,

I have some "runat server" form drop downs on the page, for example:

<asp:DropDownList ID="TypeOfParrot" Runat="server" name="TypeOfParrot"
class="textbox">
<asp:ListItem Value="">Please Select</asp:ListItem>
<asp:ListItem Value="Cockatoo">Cockatoo</asp:ListItem>
<asp:ListItem Value="MaCaw">MaCaw</asp:ListItem>
<asp:ListItem Value="African Grey">African Grey</asp:ListItem>
</asp:DropDownList>

So if the Querystring in the URL had domain.com?Parrot=Cockatoo , the
DropDownList above would default to this value both visually and behind the
scenes.

Any help again appreciated!!

Regards,

Gary.
 
J

Jeff Dillon

What have you tried? It's very similar to your other post, but instead of
..Text, it's another property in a DropDownList. Hint, look for the word
"Selected.." in one of the properties.

Jeff
 
K

Kevin

The easy way to do this is to have code in the background on your
onload function determine the value of the querystring. Then have it
iterate through the TypeOfParrot.listitems and then tell the
dropdownlist to select whichever Id you previously found.
KT
 
B

Badass Scotsman

I was playing with SelectedIndex, but just kept getting annoying errors...

Clueless :)
 
J

Jeff Dillon

So after an error, your tried something else right? Click once on
SelectedIndex, and press F1.

Did you try the other Selected.. properties? There are only 3 or so...

Let me know how it goes.

Jeff
 

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,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top