You'd use if>then statements in your dropdown or checkbox or radio button.
<%IF rs_data("Option") = x then Response.Write("Selected")%>
You'll have to put that on every option possibility.
-g
If you are populating the Select element from a recordset, here's a more
elegant way:
Sub doDropDownMatch(sql,sSelect,iMatch,oConn)
Dim rsDDL, arrDDL, dloop
Set rsDDL = oConn.execute(sql)
Response.Write "<select name=""" & sSelect & """>" & vbcrlf
Response.Write "<option></option>" & vbcrlf
If Not rsDDL.EOF Then
arrDDL = rsDDL.Getrows()
rsDDL.Close : Set rsDDL = Nothing
For dloop = 0 to Ubound(arrDDL,2)
Response.Write "<option value=""" & arrDDL(0,dloop) & """"
If IsNumeric(iMatch) Then
If Clng(arrDDL(0,dLoop)) = Clng(iMatch) Then Response.Write "
selected=""selected"""
End If
Response.Write ">" & arrDDL(1,dloop) & "</option>" & vbcrlf
Next
Else
rsDDL.Close : Set rsDDL = Nothing
End If
Response.Write "</select>"
End Sub
You'd just pass in the following arguments: the SQL that needs to be
executed, the html name attribute you want to give the Select element, the
(integer) value you want to match, and an open connection object.
--
Mike Brind
MVP - ASP/ASP.NET
> You'd use if>then statements in your dropdown or checkbox or radio button.
>
[quoted text clipped - 13 lines]
>>
>> Any help is much appreciated.
Jason - 10 Sep 2008 14:27 GMT
> If you are populating the Select element from a recordset, here's a more
> elegant way:
[quoted text clipped - 48 lines]
>
> - Show quoted text -
Here's the original code:
<input name="Child_YCSDPreviousEnrolled"
id="Child_YCSDPreviousEnrolled" type="radio" value="Yes" />Yes
<input name="Child_YCSDPreviousEnrolled"
id="Child_YCSDPreviousEnrolled" type="radio" value="No" />No
///////////////////////////////////////
So it would be changed to this:
<input name="Child_YCSDPreviousEnrolled"
id="Child_YCSDPreviousEnrolled" type="radio" value="<%IF
rs_Student("Option") = Yes then Response.Write("Selected")%>" />Yes
<input name="Child_YCSDPreviousEnrolled"
id="Child_YCSDPreviousEnrolled" type="radio" value="<%IF
rs_Student("Option") = No then Response.Write("Selected")%>" />No