asp.net two level linkage code (1/2)

Source: Internet
Author: User

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 ">
&LT;TR align= "center" >
&LT;TD height= "colspan=" 2 ">
<strong>ajaxpro realizes two level linkage </strong> </td>
</tr>
<tr class= "tdbg" >
&LT;TD width= "30%" >
Provinces </td>
&LT;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>
&LT;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;

Home 1 2 last page
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.