ӣУΣţԡʣطc_ASP.NETʲô
l(f)rg:2020-02-16 Դ: ӛȫ c
ժҪ:ĽBASP.NET AJAXɁԺͼܘԼPķն˺Ϳ͑˼g,YόHĿ_l(f),CʹASP.NET AJAX˸õÑwߵ_l(f)Ч
PI~:ASP.NET AJAX;ؼ;ն;͑
ЈD̖:TP312 īIRa:A
1
2005, Web2.0ᳱ,AjaxQ,_˟oˢ¸rĻ,ѸõÑw,ٵķ͎ؓȂy(tng)WebßoȔMă(yu),ɞֿɟWeb_l(f)g,ژ˜ʻVֺ֧͑
Ȼ,AjaxҲк֮ܶ̎:漰ļg̫,_l(f)ҪČW,ijЩ^sĿ͑˳v,Ҫ_l(f)ߌJavaScriptԼPgdzͨ;ÿNg[ṩDOMģ;pIJ,ھg[Ŀ͑ˑórdzy; ڴֱʾԼٲ֘I(y)߉Ƶ˿͑JavaScriptF(xin),ʹ͑˴a,JavaScriptZԌϲ]Ƶ֧,ʹ͑˴a|oC
C,Ajaxgă(yu)Ñw,֮̎_l(f)yóİl(f)չڅ:Ñwڵһλ,cͬr,_l(f)ЧҲݺҕ˽Q@ӵĆ},NAjaxS㑪\
2 ASP.NET AJAX?
2.1 Ajaxg
AjaxÑͷ֮gC,ɌһЩIJoAjax,Ҫķ@ȡ(sh)(j)rͨ^AjaxֱՈD1y(tng)WebģcAjax Webģ͵Ĺģʽ^:
D1y(tng)WebģcAjax Webģ͵Ĺģʽ^?
2.2 ASP.NET AJAX
еă(yu)㼼gһ,Ajaxѽ(jng),wY:{ܡUIܺ:
{һٔ(sh)Ďׂ͑˼ˎļMֻS_l(f)ߏĿ͑{÷˴aƬ,лʽݔݔ(sh)
UIһ㶼ǏĬF(xin)еČI(y)ؼ׃,ṩo_l(f)һЩW(wng)ؼDؼ͘ؼȵȡ@Щؼ֧֮ذl(f)CƲڿ͑ԄˢJavaScripta
ṩؼ͑óڃȵĘOSľģ,mͬrڿ͑˺ͷ
ASP.NET AJAX܌ڵNe,ڌF(xin)Ajaxܵͬr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ƽ_ʹASP.NET AJAX
@NrµASP.NET AJAX˟oF(xin),ֻܿ]ʹASP.NET AJAXĿ͑ˌF(xin)ʽ
ֵע,ASP.NET AJAXăɷNF(xin)ʽǻ,oɵġfġxijNF(xin)ʽHHζƫʹijNF(xin)ʽ
һN鳣Ҋ,ҌF(xin)麆ΡԡʡrԴϵy(tng)еČHÞ,νBCascadingDropDownؼʹ
CascadingDropDownAjaxControlToolkitеĽM,ÁƔ(sh)ͨDropDownListؼ,ʹa(chn)oˢµļ(lin)Ч,ͬr_l(f)̡ɼ(lin)x׃^ͨ^l(f) IIS ϵ Web Service F(xin)@ Web Service ȫؿм(lin)ĘI(y)߉ͨ^_l(f)ˆTԺܷ؏ Xml ߔ(sh)(j)Ы@P(sh)(j)PҪa:
!--бؼ--
asp:DropDownList ID=DropDownList1 runat=server SkinID=ddl1 AutoPostBack=true OnSelectedIndexChanged=DropDownList_SelectedIndexChanged/
•••
!--CascadingDropDownؼ--
ajaxToolkit:CascadingDropDown ID=CascadingDropDown1 runat=server TargetControlID=DropDownList1 LoadingText=ڼd^(q)͡ PromptText=Ոx^(q)͡ ServicePath=UserManage.asmx ServiceMethod=getAreaType Category=typename
/ajaxToolkit:CascadingDropDown
ajaxToolkit:CascadingDropDown ID=CascadingDropDown2 runat=server TargetControlID=DropDownList2 ParentControlID=DropDownList1 LoadingText=ڼdмС PromptText=ՈxмС ServicePath=UserManage.asmx ServiceMethod=getCity Category=cityname
/ajaxToolkit:CascadingDropDown
ajaxToolkit:CascadingDropDown ID=CascadingDropDown3 runat=server TargetControlID=DropDownList3 ParentControlID=DropDownList2 LoadingText=ڼdhСPromptText=ՈxhС ServicePath=UserManage.asmx ServiceMethod=getCountry Category=countryname
/ajaxToolkit:CascadingDropDown
WebServicea(бWebServicea):
//@ȡh
[WebMethod]
public CascadingDropDownNameValue[] getCountry(string knownCategoryValues, string category)
{StringDictionary kv= CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
•••
if ((kv.ContainsKey(rolename) && kv.ContainsKey(cityname) && kv[rolename] == 6fc98827-de43-4026-b67d-b4d207fb1afd)|| (kv.ContainsKey(typename) && kv.ContainsKey(cityname)))
{ DataTable countries = getCountryTable(kv[cityname].ToString());
//б
ListCascadingDropDownNameValue values = new ListCascadingDropDownNameValue();
foreach (DataRow dr in countries.Rows)
{ values.Add(new CascadingDropDownNameValue(dr[CountryName].ToString(), dr[CountryID].ToString())); }
return values.ToArray();
•••
4 YZ
ASP.NET AJAXʵֻһJavaScriptһ{.NETM,һӵƽ_,܉(chung)푑ԸӑB(ti)DDOһȫͬ͵Webóσݿ֪,ͬӴʹASP.NET AJAX,ASP.NET AJAX߀ڲİl(f)չ,ԴđAy,ASP.NET AJAX Control Toolkitṩķ˔Uչؼ,_l(f)ߘO鷽؞F(xin)еASP.NETóAjax;ƽ_όЌASP.NET AJAX˿ؼ/MČF(xin)?
īI?
[1].ASP.NET AJAXOӋ(I): ASP.NET 2.0 AJAX ExtensionscASP.NET AJAX Control Toolkit [M]. : ]늳, 2007.?
[2].ASP.NET 2.0 AjaxOӋ(II): ͑Microsoft AJAX LibrarycͨŌ[M]. : ]늳, 2007.?
[3][] Matthew MacDonald, Mario Szpuszta.ASP.NET 3.5OӋ(2) [M]. : ]늳, 2008.?
P~ ASP NET ӣУΣţԡʣطc asp net+ajax asp net ajax
cx