The foreground uses the Ajax direct call backstage method, the old person posts the question, does not have the example
The following is done by a foreground with Jquery,ajax calling the backend method do the No Refresh Cascade menu
Casmenu.aspx page:
<%@ Page language= "C #" autoeventwireup= "true" codefile= "CasMenu.aspx.cs" inherits= "_default"%> <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
CasMenu.aspx.cs
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Web;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using Casmenumodels;
Using CASMENUBLL;
Using System.Text; Public partial class _default:system.web.ui.page {public static string Strpro = String. Empty; The province dropdown item public static string strcity = String. Empty; The city dropdown item protected void Page_Load (object sender, EventArgs e) {if (!
IsPostBack) {} showpro (); #region # #省份下拉列表框///<summary>///province drop-down list box///</summary>///<RETURNS>&L T;/returns> public String Showpro () {StringBuilder str = new StringBuilder (); Get all Provinces collection list<casmenumodels.province> List = new Casmenubll.provincemanager (). Getallprovince (); Adds an initial entry str.
Append ("<option value=\"); Str.
Append ("0"); Str.
Append (">"); Str. Append("= = = Please select = = ="); Str.
Append ("</option>"); Loop Append Province Drop-down item foreach (Casmenumodels.province p in list) {str.
Append ("<option value=\"); Str.
Append (P.provinceid); Str.
Append (">"); Str.
Append (P.provincename); Str.
Append ("</option>"); return Strpro = str.
ToString (); #endregion #region # #城市下拉列表框///<summary>///city drop-down list box///</summary>///<p
Aram name= "str" > Province id</param>///<returns></returns> [System.Web.Services.WebMethod ()]
The public static string showcity (String str)//method is static {StringBuilder Strci = new StringBuilder ();
if (str = = "0")//is the initial item {strci.append ("<option value=\");
Strci.append ("Please choose");
Strci.append (">");
Strci.append ("Please choose"); Strci.apPend ("</option>"); else {list<casmenumodels.city> List = new Casmenubll.citymanager (). Getallbyproid (Convert.ToInt32 (str));
According to the province ID get the City collection foreach (Cities C in list) {Strci.append ("<option value=\");
Strci.append (C.cityid);
Strci.append (">");
Strci.append (C.cityname);
Strci.append ("</option>");
} return strcity = Strci.tostring ();
} #endregion}
I have a note of where to look,
Of course, the front desk into the background method is far more than this one, for example, and Ajaxpro also very easy to use
The above mentioned is the entire content of this article, I hope you can enjoy.