Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > onChange event

Reply
Thread Tools

onChange event

 
 
vinodkus@gmail.com
Guest
Posts: n/a
 
      08-04-2007
I have two drop down. In first drop down it shows the state name and
in second drop down it shows city of that state. but i want if any
particular state is selected then its corresponding state should be
selected in another drop down. I think onchange event is require to
write on first drop down but i dont want to put any submit button. I
want if first drop down is selected then its corresponding data should
be displayed in another drop down.
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>New Page 1</title>
</head>

<body>
<form name ="form" action="stateCity.asp" method=post>
<%
set con = Server.CreateObject("ADODB.Connection")
con.open "driver={SQL Server};server=c1;uid=sa;pwd=;database=pubs;"
set rs = con.execute("select distinct(statename) from stcity")
%>
<select name =st width=75>

<%
if not rs.eof then
while not rs.eof
%>
<option value="<%=rs(0)%>"><%=rs(0)%></option>
<%
rs.movenext
wend
end if
%>
</select>
<%
st = request.form("st")
%>
<select name=ct width=75 onChange='return st_change()'>
<%
set rs1 = con.execute("select city from stcity where statename =
'"&st&"'")
%>
<%
if not rs1.eof then
while not rs1.eof
%>
<option value="<%=rs1(0)%>"><%=rs1(0)%></option>
<%
rs1.movenext
wend
end if
%>
<script language="JavaScript">
<!--
function st_change()
{
form.submit();
}
-->
</script>
</select>
<input type = submit value = submit name=submit>
</form>
</body>
</html>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
calling clientside js with onchange event Zeebra3 ASP .Net 5 07-14-2007 11:12 PM
Onchange event - need to click out? Chris Ashley ASP .Net 1 12-06-2005 05:22 PM
using the client side "onchange" event function Norm via DotNetMonster.com ASP .Net 3 06-15-2005 01:32 PM
OnChange() Event in Struts Vitthal Bhat Java 6 02-19-2005 01:31 AM
need help determining the return value of a generated js onChange event MDBloemker ASP .Net 2 05-12-2004 02:45 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57