日期:2014-05-18 浏览次数:20474 次
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CallBack_Default.aspx.cs" Inherits="CallBack_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>使用.net回调(CallBack)技术实现局部刷新</title> <script language="javascript"> function FillData() { var city = document.getElementById("TextBox1").value; <% =ClientScript.GetCallbackEventReference(this,"city","FillDll",null) %>; } function FillDll(strCity) { document.getElementById("DropDownList1").options.length = 0; var indexofcity; var city; //分割传递来的字符串 while(strCity.length>0) { //判断是否是最后一个字符串 indexofcity = strCity.indexOf(","); if (indexofcity > 0) { city = strCity.substring(0,indexofcity); strCity = strCity.substring(indexofcity+1); //填充DropDownList1 document.getElementById("DropDownList1").add(new Option(city,city)); } else { document.getElementById("DropDownList1").add(new Option(strCity,strCity)); break; } } } </script> </head> <body> <form id="form1" runat="server"> <div> <strong>使用.net回调(CallBack)技术实现局部刷新</strong><br /> 城市名称:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <input id="Button1" type="button" value="查 询" onclick="FillData()" /><br /> 城镇:<asp:DropDownList ID="DropDownList1" runat="server"> </asp:DropDownList></div> </form> </body> </html>
------解决方案--------------------
呵呵
------解决方案--------------------
无刷新应用和数据传递
参考
http://www.cnblogs.com/sunheyubo/articles/838496.htmlhttp://www.cnblogs.com/lingxzg/articles/488484.html
------解决方案--------------------
顶了
刚建一c#群 63242231 希望有志同道合的朋友和高手指导
谢谢。。。呵呵呵
------解决方案--------------------
上边已经给的很多了.
------解决方案--------------------