<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當前位置: 首頁 - 科技 - 知識百科 - 正文

        Ajax實現無刷新三聯動下拉框

        來源:懂視網 責編:小采 時間:2020-11-27 22:52:43
        文檔

        Ajax實現無刷新三聯動下拉框

        Ajax實現無刷新三聯動下拉框:<HTML> <HEAD> <title>Ajax實現無刷新三聯動下拉框</title> <meta content=Microsoft Visual Studio .NET 7.1 name=GENERATOR> <meta content=C# name=CODE
        推薦度:
        導讀Ajax實現無刷新三聯動下拉框:<HTML> <HEAD> <title>Ajax實現無刷新三聯動下拉框</title> <meta content=Microsoft Visual Studio .NET 7.1 name=GENERATOR> <meta content=C# name=CODE

        <HTML>
        <HEAD>
        <title>Ajax實現無刷新三聯動下拉框</title>
        <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
        <meta content="C#" name="CODE_LANGUAGE">
        <meta content="JavaScript" name="vs_defaultClientScript">
        <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
        <SCRIPT language="javascript"> 
        //城市------------------------------
        function cityResult() 

        var city=document.getElementById("DropDownList1");
        AjaxMethod.GetCityList(city.value,get_city_Result_CallBack);
        }

        function get_city_Result_CallBack(response)
        {
        if (response.value != null)

        //debugger;
        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].city;
               var id=ds.Tables[0].Rows[i].cityID;
               document.all("DropDownList2").options.add(new Option(name,id));
             }
        }

        return
        }
        //市區----------------------------------------
        function areaResult() 

        var area=document.getElementById("DropDownList2");
        AjaxMethod.GetAreaList(area.value,get_area_Result_CallBack);
        }
        function get_area_Result_CallBack(response)
        {
        if (response.value != null)

        document.all("DropDownList3").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].area;
               var id=ds.Tables[0].Rows[i].areaID;
               document.all("DropDownList3").options.add(new Option(name,id));
             } 
        }
        }
        return
        }
        function getData()
        {
        var province=document.getElementById("DropDownList1");
        var pindex = province.selectedIndex;
        var pValue = province.options[pindex].value;
        var pText = province.options[pindex].text;

        var city=document.getElementById("DropDownList2");
        var cindex = city.selectedIndex;
        var cValue = city.options[cindex].value;
        var cText = city.options[cindex].text;

        var area=document.getElementById("DropDownList3");
        var aindex = area.selectedIndex;
        var aValue = area.options[aindex].value;
        var aText = area.options[aindex].text;

        var txt=document.getElementById("TextBox1"); 

        document.getElementById("<%=TextBox1.ClientID%>").innerText="省:"+pValue+"|"+pText+"市:"+cValue+"|"+cText+"區:"+aValue+"|"+aText;
        }
        </SCRIPT>
        </HEAD>
        <body ms_positioning="GridLayout">
        <form id="Form1" method="post" runat="server">
        <TABLE id="Table1" style="Z-INDEX: 101; LEFT: 96px; POSITION: absolute; TOP: 32px" cellSpacing="1"
        cellPadding="1" width="300" border="1" bgColor="#ccff66">
        <TR>
        <TD>省市</TD>
        <TD><asp:dropdownlist id="DropDownList1" runat="server"></asp:dropdownlist></TD>
        </TR>
        <TR>
        <TD>城市</TD>
        <TD><asp:dropdownlist id="DropDownList2" runat="server"></asp:dropdownlist></TD>
        </TR>
        <TR>
        <TD>市區</TD>
        <TD><asp:dropdownlist id="DropDownList3" runat="server"></asp:dropdownlist></TD>
        </TR>
        </TABLE>
        <asp:TextBox id="TextBox1" style="Z-INDEX: 102; LEFT: 416px; POSITION: absolute; TOP: 48px" runat="server"
        Width="424px"></asp:TextBox><INPUT style="Z-INDEX: 103; LEFT: 456px; WIDTH: 56px; POSITION: absolute; TOP: 96px; HEIGHT: 24px"
        type="button" value="test" onclick="getData();">
        </form>
        </body>
        </HTML>2.cs代碼
        using System;
        using System.Collections;
        using System.ComponentModel;
        using System.Data;
        using System.Drawing;
        using System.Web;
        using System.Web.SessionState;
        using System.Web.UI;
        using System.Web.UI.WebControls;
        using System.Web.UI.HtmlControls;
        namespace AjaxTest
        {
        /**//// <summary>
        /// Summary description for WebForm1.
        /// </summary>
        public class WebForm1 : System.Web.UI.Page
        {
        protected System.Web.UI.WebControls.DropDownList DropDownList1;
        protected System.Web.UI.WebControls.DropDownList DropDownList2;
        protected System.Web.UI.WebControls.TextBox TextBox1;
        protected System.Web.UI.WebControls.DropDownList DropDownList3;

        private void Page_Load(object sender, System.EventArgs e)

        Ajax.Utility.RegisterTypeForAjax(typeof(AjaxMethod));
        if(!Page.IsPostBack)
        {
        this.DropDownList1.DataSource=AjaxMethod.GetProvinceList();
        this.DropDownList1.DataTextField="province";
        this.DropDownList1.DataValueField="provinceID";
        this.DropDownList1.DataBind();

        this.DropDownList1.Attributes.Add("onclick","cityResult();");
        this.DropDownList2.Attributes.Add("onclick","areaResult();");
        }
        }

        Web Form Designer generated code#region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
        //
        // CODEGEN: This call is required by the ASP.NET Web Form Designer.
        //
        InitializeComponent();
        base.OnInit(e);
        }

        /**//// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()

        this.Load += new System.EventHandler(this.Page_Load);

        }
        #endregion 
        }
        }3.AjaxMethod
        using System;
        using System.Data;
        using System.Data.SqlClient;
        namespace AjaxTest
        {
        /**//// <summary>
        /// Summary description for AjaxMethod.
        /// </summary>
        public class AjaxMethod
        {
        GetProvinceList#region GetProvinceList
        public static DataSet GetProvinceList()
        {
        string sql="select * from province";
        return GetDataSet(sql);
        }
        #endregion

        GetCityList#region GetCityList
        [Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.Read)]
        public DataSet GetCityList(int provinceid)
        {
        string sql="select * from city where father="+provinceid;
        return GetDataSet(sql); 
        }
        #endregion

        GetAreaList#region GetAreaList
        [Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.Read)]
        public DataSet GetAreaList(int cityid)
        {
        string sql="select * from area where father="+cityid;
        return GetDataSet(sql); 
        }
        #endregion

        GetDataSet#region GetDataSet
        public static DataSet GetDataSet(string sql)
        {
        string ConnectionString=System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"];
        SqlDataAdapter sda =new SqlDataAdapter(sql,ConnectionString);
        DataSet ds=new DataSet();
        sda.Fill(ds);
        return ds;
        }
        #endregion
        }
        }4.web.config
        <httpHandlers>
        <add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax" />
        </httpHandlers>5.ajax.dll下載/Files/singlepine/Ajax.rar

        聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        Ajax實現無刷新三聯動下拉框

        Ajax實現無刷新三聯動下拉框:<HTML> <HEAD> <title>Ajax實現無刷新三聯動下拉框</title> <meta content=Microsoft Visual Studio .NET 7.1 name=GENERATOR> <meta content=C# name=CODE
        推薦度:
        • 熱門焦點

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 亚洲午夜无码久久久久| 亚洲免费视频一区二区三区| 日产亚洲一区二区三区| 日韩精品无码免费专区午夜不卡| 亚洲国产av无码精品| 又黄又大的激情视频在线观看免费视频社区在线 | 永久免费A∨片在线观看| 久久亚洲高清综合| a毛片在线免费观看| 久久精品国产亚洲夜色AV网站| 免费成人在线视频观看| 亚洲视频在线观看免费视频| 91热成人精品国产免费| 中文字幕亚洲精品无码| 大学生高清一级毛片免费| 国产精品亚洲а∨无码播放麻豆 | 亚洲国产综合无码一区| 久久99热精品免费观看动漫 | 福利片免费一区二区三区| 亚洲精品乱码久久久久久蜜桃| 9久久免费国产精品特黄| 午夜亚洲AV日韩AV无码大全| 国产四虎免费精品视频| 精品国产亚洲AV麻豆| 亚洲精品自产拍在线观看| 24小时免费看片| 人人狠狠综合久久亚洲| 亚洲日韩国产精品第一页一区| 四虎免费影院ww4164h| 在线观看亚洲精品专区| 久久精品国产69国产精品亚洲| 亚洲美女视频免费| 一级特级女人18毛片免费视频| 亚洲av无码一区二区三区不卡| 在线视频观看免费视频18| 老司机免费午夜精品视频| 亚洲Aⅴ无码专区在线观看q| 无码国产精品久久一区免费| 国产精品1024在线永久免费 | 亚洲色欲色欲www在线丝| 曰批视频免费30分钟成人|