Value from my drop down.

andycharger

Centurion
Joined
Apr 2, 2003
Messages
152
I have a Drop down box on my page. Its not ASPX generated one, its HTML.

It looks like this:
<SELECT class="boxtext" name="drpReason">
<OPTION selected value=1>Select...</OPTION>
<OPTION value=2>Overcharging</OPTION>
<OPTION value=3>Delays</OPTION>

</SELECT>

Now what I want to do is when I post the page to itself set the VALUE to a variable.
I can get the string from the text box by typing: strReason = Request.form("drpReason")

But I want to get the Value number.

When I set strReason to an Integer and try and do the following, I get an error
strReason = Request.form("drpReason").value

Any ideas how I do it?

Andy
 
I think you will need to add the runat="server" attribute and rename the 'name' attribute to 'id'. You then won't need to use Request.Form... you can just do

drpReason.Items[drpReason.SelectedIndex].Text

you should disable the viewstate of the drpReason after adding the runat="server" attribute.
 
Back
Top