一区二区久久-一区二区三区www-一区二区三区久久-一区二区三区久久精品-麻豆国产一区二区在线观看-麻豆国产视频

asp.net 結合YUI 3.0小示例

注:由于本人主要做后臺的就只用到了IO空間下面的一些東西,貼個小小的級聯效果來吧,
廢話少說先拿代碼說話了,
復制代碼 代碼如下:
Demo.show={
Test:function(e,Y)
{
config=Demo.config;
function onshengchange(e)
{
var sheng = Y.Node.get('#'+config.sheng).get("value");
var speccode = Y.Node.get('#'+config.speciality);
var years = Y.Node.get('#'+config.years);
var timeslist =Y.Node.get('#'+config.times);
var content="<option selected=selected>請選擇</option>";
speccode.setContent("<option selected=selected>加載數據....</option>");
years.setContent(content);
timeslist.setContent(content);
var requestSpeciality = Y.io("Test.ASPx", {
                method:"POST",
                data:"type=sheng&sheng="+sheng,
                arguments:{event:"cclchange"},
                on:
                    {
                        success:successHandler,
                        failure:failureHandler
                    }
                }
            );
}
function onspecialitychange(e)
{

var sheng = Y.Node.get('#'+config.sheng).get("value");
var speccode = Y.Node.get('#'+config.speciality).get("value");
var years = Y.Node.get('#'+config.years);
var timeslist =Y.Node.get('#'+config.times);
var content="<option selected=selected>請選擇</option>";
years.setContent("<option selected=selected>加載數據....</option>");
timeslist.setContent(content);
var requestSpeciality = Y.io("Test.ASPx", {
                method:"POST",
                data:"type=speciality&cclid="+ccl+"&speccode="+speccode,
                arguments:{event:"specchange"},
                on:
                    {
                        success:successHandler,
                        failure:failureHandler
                    }
                }
            );
}
function onyearchange(e)
{
var sheng = Y.Node.get('#'+config.sheng).get("value");
var speccode = Y.Node.get('#'+config.speciality).get("value");
var year = Y.Node.get('#'+config.years).get("value");
var timeslist =Y.Node.get('#'+config.times);
timeslist.setContent("<option selected=selected>加載數據....</option>");
var requestSpeciality = Y.io("Test.ASPx", {
                method:"POST",
                data:"type=year&sheng="+sheng+"&speccode="+speccode+"&year="+year,
                arguments:{event:"yearchange"},
                on:
                    {
                        success:successHandler,
                        failure:failureHandler
                    }
                }
            );
}

function ontimeslistchagne(e){
//這里可以一直連下去
}
function successHandler(id, o,args){
if(args!=null)
if(args.event!=null)
{
if(args.event=='shengchange')
{
var root = o.responseXML.documentElement;
var speciality =Y.Node.get('#'+config.speciality);
var content="<option selected=selected>請選擇</option>";
             for(i=0;i<root.childNodes.length;i++)
             {
             var node=root.childNodes[i];
             var value=node.getElementsByTagName("Code")[0].text;
             var text=node.getElementsByTagName("CName")[0].text;
             content+="<option value="+value +">"+text+"</option>";
             }
             speciality.setContent(content);
}
else if(args.event=='specchange')
{
var root = o.responseXML.documentElement;
var yearlist =Y.Node.get('#'+config.years);
var content="<option selected=selected>請選擇</option>";
             for(i=0;i<root.childNodes.length;i++)
             {            
             var value=root.childNodes[i].text;
             var text=value;
             content+="<option value="+value +">"+text+"</option>";
             }
             yearlist.setContent(content);
}
else if(args.event=='yearchange')
{
var root = o.responseXML.documentElement;
var timeslist =Y.Node.get('#'+config.times);
var content="<option selected=selected>請選擇</option>";
var times=Y.DataType.Number.parse(root.text);
if(times==null)
times=0;
             for(i=0;i<times;i++)
             {            
             content+="<option value="+(i+1) +">"+(i+1)+"</option>";
             }
             timeslist.setContent(content);
}

            }
        }

        
        function failureHandler(id, o){
        alert("數據獲取成功");
        }
        var sheng = Y.Node.get('#'+config.sheng);
var speccode = Y.get('#'+config.speciality);
var year = Y.get('#'+config.years);
var timeslist =Y.Node.get('#'+config.times);

        sheng.on("change",oncclchange);
        speccode.on("change",onspecialitychange);
        year.on("change",onyearchange);
        timeslist.on("change",ontimeslistchagne);

}
};
YUI().use("node","datatype-number","io-base",function(Y) {
function onload(e)
{
Demo.show.Test(e,Y);
}
Y.on("load", onload, window);
});


復制代碼 代碼如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.ASPx.cs" Inherits="Test" %>
<!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>無標題頁</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<ASP:DropDownList ID="sheng" runat="server">
</ASP:DropDownList>
<ASP:DropDownList ID="speciality" runat="server">
</ASP:DropDownList>
<ASP:DropDownList ID="year" runat="server">
</ASP:DropDownList>
<ASP:DropDownList ID="times" runat="server">
</ASP:DropDownList>
</div>
</form>
</body>
</html>


復制代碼 代碼如下:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
public partial class Test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.ClientScript.IsClientScriptIncludeRegistered("YUI"))
Page.ClientScript.RegisterClientScriptInclude("YUI", path + "/build/yui/yui-min.js");
if (!Page.ClientScript.IsClientScriptIncludeRegistered("CLINET"))
Page.ClientScript.RegisterClientScriptInclude("CLINET", path + "/js/cliNET.js");
StringBuilder scriptBlock = new StringBuilder();
scriptBlock.Append("<script type="text/Javascript"><!--
");
scriptBlock.Append("Demo.config={");
scriptBlock.Append("sheng:'" + this.sheng.ClientID + "',");
scriptBlock.Append("speciality:'" + this.specialityList.ClientID + "',");
scriptBlock.Append("years:'" + this.yearList.ClientID + "',");
scriptBlock.Append("times:'" + this.timesList.ClientID + "'");
scriptBlock.Append("};");
scriptBlock.Append("
// --></script>");
Page.ClientScript.RegisterClientScriptBlock(GetType(), "QualityAssessmentPlanCascadingDropDown", scriptBlock.ToString());

}
}

這上面為主要代碼,上面那段JS我實際寫的請求的是一個WEBService ,你可以換一個ASPx頁面都行,

還有一些后臺處理的到數據的就沒有貼出來了,每一個級聯請求的后臺都是返回一個對象數組 ,具體的解釋就不用說了, 不懂的在討論。。。

AspNet技術asp.net 結合YUI 3.0小示例,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 午夜亚洲国产成人不卡在线 | 性做久久久久 | 2020年国产精品午夜福利在线观看 | 大臿蕉香蕉大视频成人 | 成人精品综合免费视频 | 精品视频在线看 | 中文字幕在线观看国产 | 亚洲国产精品成人综合色在线婷婷 | 五月婷婷综合激情网 | 伊人久久大香 | 日韩三极 | 亚洲图片小说综合 | 午夜视频久久久久一区 | 国产视频国产 | 91久久网| 亚洲国产精品第一页 | 99伊人 | 91精品国产综合久久久久久 | 成人小视频免费在线观看 | 激情偷拍网 | 国内黄色一级精品 | 亚洲国产婷婷香蕉久久久久久 | 狠狠做狠狠做综合日日 | 99在线视频免费观看 | 在线激情网 | 日韩在线观看一区 | 亚洲欧美日韩国产一区二区精品 | 69国产成人精品午夜福中文 | 精品日韩欧美一区二区三区 | 国产专区一区 | 在线免费观看黄色网址 | 国产四虎免费精品视频 | 欧美视频精品 | 日本人真淫视频一区二区三区 | 99精品视频在线这里只有 | 精品伊人 | 日本xxx在线观看免费播放 | 性夜影院爽黄e爽痛轻点www | 欧美sese| 国产高清国内精品福利 | 美女隐私视频黄www视频 |