|
-
Jun 29th, 2001, 06:04 AM
#1
Thread Starter
Addicted Member
Drop-down list problem
Dear all,
Im populating data from the database into a drop-down box.
Its working fine as far as putting the data from the db to the drop-down.
My problem is when I want a particular record's value has to be displayed after populating, how do i do that?
For instance, the drop-down already has populated data (1,2,,,10)
I want the drop-down to show 5 (with 1..10 being there in the drop-down), how do I do that?
Thanx in advance
Parasuraman
-
Jun 29th, 2001, 06:35 AM
#2
<OPTION value=1 selected>1</OPTION>
Simon
-
Jun 29th, 2001, 06:39 AM
#3
Thread Starter
Addicted Member
Thanx Simon,
But, if the value in the drop-down is going to be dynamic, I want to mix it with asp and html code. i have problem in that.
Any advise?
thanx again
-
Jun 29th, 2001, 06:45 AM
#4
Well the user dosent see the ASP
I think i have an idea, as you loop thru do a simple If...Then, if its the one you want to be selected, put in the "selected" if not leave it
quick example, hopefully should give you and idea......
Code:
Dim i
Dim SelectedNumber
SelectedNumber = 5
For i = 1 to 10
If i = SelectedNumber Then
Response.Write("<OPTION value=" & i & " selected>" & i & "</OPTION>")
Else
Response.Write("<OPTION value=" & i & ">" & i & "</OPTION>")
End If
Next i
-
Jun 29th, 2001, 07:03 AM
#5
Thread Starter
Addicted Member
Dear Chenko,
Thats a good idea. Thanx for that. I'll try that logic
Cheers
Parasuraman
-
Jun 29th, 2001, 07:21 AM
#6
Thread Starter
Addicted Member
Dear Chenko,
The logic is working fine. Thanx alot
Thanx again
Parasuraman
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|