asp.net implementation of DropDownList linkage control without refreshing

Source: Internet
Author: User
On the internet saw some no refresh of the linkage control. After the test, the display of English and the number can be, but not to display Chinese, and then down from the Internet down the file made a change, made a provincial and municipal linkage control. Share it for everyone. Can be displayed in Chinese.

function Load (state) {
var drp2 = document.getElementById ("DropDownList2");
for (i = Drp2.length i >= 0; i--) {
Drp2.options.remove (i);
}

var ohttpreq = new ActiveXObject ("MSXML2. XMLHTTP ");
var odoc = new ActiveXObject ("MSXML2. DOMDocument ");
Using escape here can solve the problem of Chinese
Ohttpreq.open ("POST", "getdata.aspx?state=" +state, false);
Ohttpreq.send ("");
result = Ohttpreq.responsetext;
Odoc.loadxml (result);
ITEMS1 = Odoc.selectnodes ("//city/table/id");
ITEMS2 = Odoc.selectnodes ("//city/table/shiname");

var itemslength=items1.length;
for (i=0;i<itemslength;i++)
Assign the class name and number of a small class to DropDownList2
{
var newoption = document.createelement ("option");
Newoption.text=items2[i].text;
Newoption.value=items1[i].text;
Drp2.options.add (newoption);
}
}
Window.onload = function () {load (' 1 ');}
<%@ Page language= "C #" codebehind= "Example.aspx.cs" autoeventwireup= "false" inherits= "Webs.other.Example"%>
<HTML>
<HEAD>
<title>Example</title>
<meta name= "generator" content= "Microsoft Visual Studio. NET 7.1" >
<meta name= "Code_language" content= "C #" >

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.