This is the use of Ajax technology, the refresh is positive, is at the speed we do not perceive to complete. XMLHTTP Sacrifice page method, we can not see the refresh, because all the work is in the Sacrifice page, inside the "boil" "toss", we can not see, efficiency on the worse!
AjaxPro.dll Download Address Http://ajaxpro.schwarz-interactive.de/download/ajaxpro.zip
Web.config
<?xml version= "1.0"?>
<configuration>
<system.web>
<add verb= "Post,get" path= "Ajax/*.ashx" type= "Ajax.pagehandlerfactory, Ajax"/>
<add verb= "Post,get" path= "Ajaxpro/*.ashx" type= "ajaxpro.ajaxhandlerfactory,ajaxpro.2"/>
</system.web>
</configuration>
Ajaxtest.aspx
<%@ Page language= "C #" autoeventwireup= "true" codefile= "AjaxTest.aspx.cs" inherits= "Ajaxtest"%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title> Untitled Page </title>
<body>
<script language= "javascript" type= "Text/javascript" >
function Arearesult ()
{
var Area=document.getelementbyid ("DropDownList1");
alert (Area.value);
Ajaxtest.getcitylist (Area.value,get_city_result_callback);
}
function Get_city_result_callback (response)
{
if (Response.value!= null)
{
document.all ("DropDownList2"). length=0;
var ds = Response.value;
if (ds!= null && typeof (ds) = = "Object" && ds. Tables!= null)
{
for (var i=0; I<ds. Tables[0]. Rows.length; i++)
{
var name=ds. Tables[0]. Rows[i].name;
var id=ds. Tables[0]. Rows[i].id;
document.all ("DropDownList2"). Options.add (New Option (Name,id));
}
document.all ("TextBox1"). value= "";
}
}
Return
}
</script>
<form id= "Form1" runat= "Server" >
<asp:dropdownlist id= "DropDownList1" runat= "Server" >
</asp:DropDownList>
<asp:dropdownlist id= "DropDownList2" runat= "Server" >
</asp:DropDownList>
<br/>
</form>
</body>