This is related to Classic ASP code.
A page fetches data for a particular ProjectCode.
There is a general text field which shows the Site-Location for selected Project-Code. I want to change it to drop down, so that a user can change the Site-Location from options available (fetched from DB) and then save it. Also, on page load the Site-Location of Project-Code for that particular entry should be selected.
I have added following code to my Page, but it doesn’t work(definately I am new to classic ASP).
strSQL = "SP_GET_SiteLocation"
Set rsSiteList = RunSQLQuery(strSQL)
'show the list
If Not rsSiteList.EOF Then
Do While NOT rs.EOF
SiteLocationList= SiteLocationList & "<option value="">" & rs("LOCATION") & "</option>"
rs.MoveNext
Also, on click of save button, i have to send the selected drop down value to update query.
You use a wrong name for the recordset variable..
You named it
rsSiteListbut you use it asrsUpdate
You are building a string with all the options ..
you should write it in the page at some point..
response.write(SiteLocationList)or write the
<options>directly to the page..update 2
Not sure why you do not want to print the options as you read them from the recordset but prefer to make a huge string instead and print that at the end … it is the same thing but much more cleaner ..
The following should select the location that matches the rsReqDetails(“AppReqSiteID”)
In general you need to watch the nesting of html as it can mess everything up. Also you need to read a little on the interactions between ASP and HTML …