Results 1 to 2 of 2

Thread: How to select the option?

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    Ohio
    Posts
    59
    How can I set the selected option for a select object (dropdown list) based on the value in the database table?

    This is how I'm populating my input boxes.

    <input name="Fax" size="30" value="<%= trim(rs("tpFax")) %>">

    How can I do that for a select object?

    This is how I'm populating the select object.
    <SELECT id=select1 name="Role_T2" size="1">
    style="HEIGHT: 22px; WIDTH: 281px">
    <OPTION value="1">Technical
    <option value="2">Project Manager
    </option></SELECT>

    Thanks.

  2. #2
    Member
    Join Date
    Aug 2000
    Location
    Florida
    Posts
    45

    How to select the option?

    I use something like this...
    <%
    Dim strSelected
    %>
    <select name="cboDiscount" size="1" >
    <%
    If (some condition here) Then
    strSelected = "Selected"
    Else
    strSelected = ""
    End If
    %>
    <OPTION value="whatever" <% =strSelected %> > myLabel</OPTION>
    </select>

    Notice the <% =strSelected %> will have the value "Selected" when the condition is met.

    Hope this helps.
    If I could only remember my name...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width