ASP tutorial. NET Two-level linkage code is a comparison of the example code, this is the use of the ASP.net tutorial using Ajaxpro to achieve the two-level linkage code, if you are looking for this two-level linkage code to come in and see OH.
<%@ page language= "C #" autoeventwireup= "true" codefile= "Test.aspx.cs" inherits= "test"%>
<!doctype HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/ Xhtml1-transitional.dtd ">
<title>ajaxpro realizes two level linkage </title>
<body>
<form id= "Form1" runat= "Server" >
<div>
<table width= "border=" 0 "align=" center "cellpadding=" 3 "cellspacing=" 1 "bordercolor=" #ffffff "style=" Border-collaps Tutorial E:collapse ">
<TR align= "center" >
<TD height= "colspan=" 2 ">
<strong>ajaxpro realizes two level linkage </strong> </td>
</tr>
<tr class= "tdbg" >
<TD width= "30%" >
Provinces </td>
<TD width= "70%" align= "left" >
<asp:dropdownlist id= "ddlstatelist" runat= "Server" datatextfield= "StateName" datavaluefield= "Stateid" >
</asp:dropdownlist></td>
</tr>
<tr class= "tdbg" >
<td><strong> City </strong></td>
<TD align= "Left" >
<asp:dropdownlist id= "ddlcitylist" runat= "Server" >
</asp:dropdownlist></td>
</tr>
</table>
</div>
<script language= "Web Effects" type= "Text/javascript" defer= "defer" >
function showcity (ID)
{
var res=test.getcitylist (parseint (ID)). value;
var Ddl=document.getelementbyid ("<%=ddlcitylist.uniqueid%>");
ddl.length=0;
if (res)
{
Res is a list<city> collection returned by the server
for (Var i=0;i<res.length;i++)
{
Ddl.options.add (new option (Res[i].cityname,res[i].cityid));
From the above you can see that you can directly call elements in the List<city> collection and their properties
}
}
}
</script>
</form>
</body>
<div Class=cnblogs_highlighter><pre class=brush:csharp>using System;
Using System.Data;
Using System.Configuration;
Using System.Collections;
Using System.Collections.Generic;
Using System.Web;
Using System.Web.Security;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.web.ui.webcontrols.webparts;
Using System.Web.UI.HtmlControls;