SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
Thread: Convert JSP code in ASP
-
Dec 17, 2010, 03:11 #1
- Join Date
- May 2009
- Posts
- 8
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Convert JSP code in ASP
i want to Convert the below given jsp code in asp.
<select size="1" name="s" style="width: 150">
<option <%=s.equals("abc") ? "selected" : "" %> value="abc">abc</option>
</select>.
Please guide.
-
Dec 17, 2010, 10:43 #2
- Join Date
- Jun 2007
- Posts
- 691
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Code ASP:<select size="1" name="s" style="width: 150" value="abc"> <option <% if [put option value here]="abc" then response.write( " selected " ) %> >abc</option> </select>.
-
Dec 17, 2010, 12:23 #3
- Join Date
- May 2009
- Posts
- 8
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
iT DOESNT WORKS.
I have exactly this code.
<% SQL ="Select City From City order By City"
Set rs = sconn.Execute(SQL)%>
<select name="Location" size="1">
<option >- Select -</option>
<%while not rs.EOF%>
<option value=<%=rs(0)%>><%=rs(0)%></option>
<%RS.MoveNext
wend%>
</select>
I have two combo box like this..now suppose i save selected item from two combo in the database..
now i want that when i click on update button the two combox box should come with that saved selected value along all the another values also...
Please guide how to make changes in this.
-
Dec 17, 2010, 17:55 #4
- Join Date
- Jun 2007
- Posts
- 691
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
before it can be shown as selected you must have two things
1] a comparison check to find a match and
2] the word "selected" placed into the option tag
Code ASP:<select name="Location" size="1"> <option >- Select -</option> <% SQL ="Select City From City order By City" Set rs = sconn.Execute(SQL) while not rs.EOF 'initialize value for select '------------------------------- vSelected = "" ' make a comparison '------------------------- if rs(0) = "[your comparison value must be provided here]" then vSelected = " selected " 'place selected word into option tag if match exists '---------------------------------------------------------------- %> <option <%=vSelected%>value="<%=rs(0)%>"><%=rs(0)%></option> <% RS.MoveNext wend %> </select>
Bookmarks