Finding item in dropdownlist

M

Morten Snedker

When initializing form (form load) I have

lstRadiator.Items.FindByValue("5").Selected = True

So when the page is shown in the browser, why doesn't it show option
value #5 on the list? It just keep showing the first item ("999")...?

Looking the code from browser:

<select name="lstRadiator" id="lstRadiator"
title="Choose item" style="font-size:Smaller;width:115px;">
<option value="999">--Choose --</option>
<option value="1">De Longhi</option>
<option value="2">Demrad</option>
<option value="3">Eurorad</option>
<option value="16">Hudevad</option>
<option value="5">Ludvig</option>
<option value="6">Mari</option>
<option value="7">Purmo</option>
<option value="8">Rio</option>
<option value="12">Thor</option>
<option value="15">Veha</option>
<option value="1000">--&gt; Other &lt;--</option>



Regards /Snedker
 
P

Page Brooks

Morten,

Placing the following code into the Page_Load event seems to work properly
for me:

lstRadiator.Items.FindByValue("5").Selected = true;

The only difference in my code is that you are missing a runat="server"
attribute in your select element. Could this be your problem?
 
M

Morten Snedker

On Sun, 21 Jan 2007 19:04:09 -0500, "Page Brooks"


All is well. I tried to select from the list before anything was in
it. Somehow Microsoft still fails at meeting my shortcomings. ;-)

Thanks for your replay anyway!

Regards /Sendker
 

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