|
-
Dec 7th, 2005, 06:27 AM
#1
Thread Starter
Addicted Member
Undeclared Control in ASP
Assume it Connects to the DB and here is part if the Body:
VB Code:
While Not rs.EOF ' rs is the recordset
Response.Write("<tr>")
Response.Write("<td align='left'><i>" & rs.Fields(0).Value & "</i></td>")
Response.Write("<td align='left'>" & rs.Fields(1).Value & "</td>")
Response.Write("</tr>")
CountryValueList &= "<option value = " & rs.Fields(1).Value & ">" & rs.Fields(0).Value & "</option>"
rs.MoveNext
End While
response.write("</table>")
Response.Write("<br><h4 align = 'center'><SELECT name='CarValue' id='ZarValue'>" & CountryValueList & "</SELECT>")
DatabaseConnection.close
'If (Request.Form("btnCalculateRate") = "Calculate Rate") Then
'button was pressed
'Else
'Session.Abandon
'End If
Response.Write("<br><h4 align = 'center'>" & CarValue.selectedindex.value & ")
Response.Write("<br><input type='submit' name='btnCalculateRate' value='Calculate Rate'/>
CarValue is the name assigned to the Combobox.
CountryValueList is the name of the countries and the value for each Country is an ID for Example:
South Africa is the Item displayed, its hidden value is 0.88 for example
The problem is the line:
Response.Write("<br><h4 align = 'center'>" & CarValue.selectedindex.value & ") gives the error saying CarValue is undeclared. I also would Like the Code where if I click Sumit it would take the Current Selected Country in the ComboBox, then Display it in a Label. That is what I Am trying to do in the If Statements:
VB Code:
'If (Request.Form("btnCalculateRate") = "Calculate Rate") Then
'button was pressed
'Else
'Session.Abandon
'End If
Thanks
Curiosity SKILLED the cat
Google Talk from your Mobile phone
Chat from your mobile or get an emulator like J2ME Wireless Toolkit 2.2
-
Dec 7th, 2005, 08:44 AM
#2
Re: Undeclared Control in ASP
You're mixing up two things. ASP script doesn't know of the <SELECT> element. To retrieve the value selected from the combobox, use Request.Form() or Request.QueryString().
The same applies for displaying it in a label. Retrieve the value, then write it out.
-
Dec 7th, 2005, 09:16 AM
#3
Thread Starter
Addicted Member
Re: Undeclared Control in ASP
What you Mean? That Above puts the Data into the Combo Box.
Do I need to Retrieve it using response.write?
Here is the response.write I use:
Response.Write("<br><h4 align = 'center'>" & CarValue.selectedindex.value & ")
in the select statement doesnt name='carvalue' declare it right
Curiosity SKILLED the cat
Google Talk from your Mobile phone
Chat from your mobile or get an emulator like J2ME Wireless Toolkit 2.2
-
Dec 7th, 2005, 09:19 AM
#4
Re: Undeclared Control in ASP
No it doesn't. They are separate. ASP 3.0 cannot 'see' carvalue. It only knows what has been submitted to it. Which is why you need to use Request()
-
Dec 8th, 2005, 05:53 AM
#5
Thread Starter
Addicted Member
Re: Undeclared Control in ASP
Please Give an Example, in the Above Example
Curiosity SKILLED the cat
Google Talk from your Mobile phone
Chat from your mobile or get an emulator like J2ME Wireless Toolkit 2.2
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
|