Jquery+ajax Implement no Flush cascading menu Example _jquery

Source: Internet
Author: User
Tags flush

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>///&LT;RETURNS&GT;&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.

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.