Lingkungan pengembangan VS.NET 2005 C# Oracle AjaxPro
Saya sibuk akhir-akhir ini dan tidak punya waktu untuk menjelaskan secara detail, jadi saya akan memposting kode sumber umum untuk melihatnya sendiri.
Untuk alasan kinerja, tingkat provinsi dan kota ditulis sebagai susunan JS, dan tingkat kabupaten dan kabupaten (kota) ditulis dalam Oracle. Picu C# untuk membaca database melalui JS, lalu meneruskan data kembali ke JS, lalu mengikatnya untuk ditampilkan.
Operasi <select> menggunakan createElement() yang lebih umum daripada menggunakan options.add()
<%@ Halaman Language="C#" AutoEventWireup="true" CodeFile="Area.aspx.cs" Inherits="Area" %>
<!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>Wilayah</title>
</kepala>
<tubuh>
<form id="form1" runat="server">
<tabel>
<tr>
<td>
<pilih id="SF">
<optionselect="selected">—Silakan pilih—</option>
</pilih>
</td>
<td>
<pilih id="CS">
<optionselect="selected">—Silakan pilih—</option>
</pilih>
</td>
<td>
<pilih id="Xian">
<optionselect="selected">—Silakan pilih—</option>
</pilih>
</td>
<td>
<pilih id="Zhen">
<optionselect="selected">—Silakan pilih—</option>
</pilih>
</td>
</tr>
</tabel>
<skrip tipe="teks/javascript">
var aDQ=Array baru();
aDQ[0]=["11","Beijing","0","bj"];
aDQ[1]=["12","Tianjin","0","tj"];
aDQ[2]=["13","Hebei","0","hb"];
aDQ[3]=["14","Shanxi","0","shang"];
aDQ[4]=["15","Mongolia Dalam","0","nmg"];
aDQ[5]=["21","Liaoning","0","ln"];
aDQ[6]=["22","Jilin","0","jl"];
aDQ[7]=["23","Heilongjiang","0","hlj"];
aDQ[8]=["31","Shanghai","0","sh"];
aDQ[9]=["32","Jiangsu","0","js"];
aDQ[10]=["33","Zhejiang","0","zhej"];
aDQ[11]=["34","Anhui","0","ah"];
aDQ[12]=["35","Fujian","0","fj"];
aDQ[13]=["36","Jiangxi","0","jw"];
aDQ[14]=["37","Shandong","0","sd"];
aDQ[15]=["41","Henan","0","dia"];
aDQ[16]=["42","Hubei","0","hu"];
aDQ[17]=["43","Hunan","0","hn"];
aDQ[18]=["44","Guangdong","0","gd"];
aDQ[19]=["45","Guangxi","0","gx"];
aDQ[20]=["46","Hainan","0","hain"];
aDQ[21]=["50","Chongqing","0","cq"];
aDQ[22]=["51","Sichuan","0","sc"];
aDQ[23]=["52","Guizhou","0","gui"];
aDQ[24]=["53","Yunnan","0","yn"];
aDQ[25]=["54","Tibet","0","wc"];
aDQ[26]=["61","Shaanxi","0","shangx"];
aDQ[27]=["62","Gansu","0","gs"];
aDQ[28]=["63","Qinghai","0","qh"];
aDQ[29]=["64","Ningxia","0","nx"];
aDQ[30]=["65","Xinjiang","0","xj"];
aDQ[31]=["71","Taiwan","0","tw"];
aDQ[32]=["81","Hongkong","0","xg"];
aDQ[33]=["82","Makau","0","saya"];
aDQ[34]=["1101","Kota Beijing","11","bjcq"];
aDQ[35]=["1102","Kabupaten Beijing","11","bjxq"];
aDQ[36]=["1201","Kota Tianjin","12","tjcq"];
aDQ[37]=["1202","Kabupaten Tianjin","12","tjxq"];
aDQ[38]=["1301","Shijiazhuang","13","sjz"];
aDQ[39]=["1302","Tangshan","13","hbts"];
aDQ[40]=["1303","Qinhuangdao","13","qhd"];
aDQ[41]=["1304","Handan","13","hd"];
aDQ[42]=["1305","Xingtai","13","hbxt"];
aDQ[43]=["1306","Baoding","13","bd"];
aDQ[44]=["1307","Zhangjiakou","13","zjk"];
aDQ[45]=["1308","Chengde","13","cd"];
aDQ[46]=["1309","Cangzhou","13","hbcz"];
aDQ[47]=["1310","Langfang","13","lf"];
aDQ[48]=["1311","Hengshui","13","hbhs"];
aDQ[49]=["1401","Taiyuan","14","ty"];
aDQ[50]=["1402","Datong","14","dt"];
aDQ[51]=["1403","Yangquan","14","yq"];
aDQ[52]=["1404","Changzhi","14","swcz"];
aDQ[53]=["1405","Jincheng","14","swjc"];
aDQ[54]=["1406","Shuozhou","14","swsz"];
aDQ[55]=["1501","Hohhot","15","hhht"];
aDQ[56]=["1502","Baotou","15","bt"];
aDQ[57]=["1503","Wuhai","15","nmgwh"];
aDQ[58]=["1504","Chifeng","15","cf"];
aDQ[59]=["1521","Liga Hulunbuir","15","hlbem"];
aDQ[60]=["1522","Liga Xing'an","15","xam"];
aDQ[61]=["1523","Zhelimeng","15","zlmm"];
aDQ[62]=["1525","Liga Xilingol","15","wlglm"];
aDQ[63]=["1526","Liga Ulanqab","15","wlcbm"];
aDQ[64]=["1527","Ordos","15","kebutuhan"];
aDQ[65]=["1528","Liga Bayannur","15","bynem"];
aDQ[66]=["1529","Liga Alxa","15","alsm"];
aDQ[67]=["2101","Shenyang","21","lnsy"];
aDQ[68]=["2102","Dalian","21","dl"];
aDQ[69]=["2103","Anshan","21","as"];
aDQ[70]=["2104","Fushun","21","lnfs"];
aDQ[71]=["2105","Benxi","21","bx"];
aDQ[72]=["2106","Dandong","21","dd"];
aDQ[73]=["2107","Jinzhou","21","jz"];
aDQ[74]=["2108","Yingkou","21","yk"];
aDQ[75]=["2109","Fuxin","21","fx"];
aDQ[76]=["2110","Liaoyang","21","lnly"];
aDQ[77]=["2111","Panjin","21","pj"];
aDQ[78]=["2112","Mengikat","21","lntl"];
aDQ[79]=["2113","Chaoyang","21","cy"];
aDQ[80]=["2114","Huludao","21","hld"];
aDQ[81]=["2201","Changchun","22","cc"];
aDQ[82]=["2202","Jilin","22","jljl"];
aDQ[83]=["2203","Siping","22","sp"];
aDQ[84]=["2204","Liaoyuan","22","jlly"];
aDQ[85]=["2205","Tonghua","22","th"];
aDQ[86]=["2206","白山","22","bs"];
aDQ[87]=["2207","松元","22","jlsy"];
aDQ[88]=["2208","Baicheng","22","bc"];
aDQ[89]=["2224","Yanbian","22","jlyb"];
aDQ[90]=["2301","Harbin","23","heb"];
aDQ[91]=["2302","Qiqihar","23","qqhe"];
aDQ[92]=["2303","Jixi","23","hljjw"];
aDQ[93]=["2304","Hegang","23","hg"];
aDQ[94]=["2305","Shuangyashan","23","sys"];
aDQ[95]=["2306","Daqing","23","dq"];
aDQ[96]=["2307","Yichun","23","hljyc"];
aDQ[97]=["2308","Jiamusi","23","jms"];
aDQ[98]=["2309","Qitaihe","23","qth"];
aDQ[99]=["2310","Mudanjiang","23","mdj"];
aDQ[100]=["2311","Heihe","23","hh"];
aDQ[101]=["3101","Wilayah perkotaan Shanghai","31","shsq"];
aDQ[102]=["3102","Kabupaten Shanghai","31","shxq"];
aDQ[103]=["3201","Nanjing","32","nj"];
aDQ[104]=["3202","Wuxi","32","ww"];
aDQ[105]=["3203","Xuzhou","32","xz"];
aDQ[106]=["3204","Changzhou","32","jscz"];
aDQ[107]=["3205","Suzhou","32","shu"];
aDQ[108]=["3206","Nantong","32","nt"];
aDQ[109]=["3207","Lianyungang","32","lyg"];
aDQ[110]=["3208","Huaian","32","ha"];
aDQ[111]=["3209","Yancheng","32","jsyc"];
aDQ[112]=["3210","Yangzhou","32","yz"];
aDQ[113]=["3211","Zhenjiang","32","jszj"];
aDQ[114]=["3212","Taizhou","32","tz"];
aDQ[115]=["3213","Suqian","32","sq"];
aDQ[116]=["3301","Hangzhou","33","han"];
aDQ[117]=["3302","Ningbo","33","nb"];
aDQ[118]=["3303","Wenzhou","33","zjwz"];
aDQ[119]=["3304","Jiaxing","33","jx"];
aDQ[120]=["3305","Huzhou","33","zjhz"];
aDQ[121]=["3306","Shaoxing","33","sx"];
aDQ[122]=["3307","Jinhua","33","jh"];
aDQ[123]=["3308","Quzhou","33","zjqz"];
aDQ[124]=["3309","Zhoushan","33","zjzs"];
aDQ[125]=["3310","Taizhou","33","zjtz"];
aDQ[126]=["3311","Yiwu","33","yw"];
aDQ[127]=["3325","Lishui","33","zjls"];
aDQ[128]=["3401","Hefei","34","hf"];
aDQ[129]=["3402","Wuhu","34","wh"];
aDQ[130]=["3403","Bengbu","34","bb"];
aDQ[131]=["3404","Huainan","34","hnx"];
aDQ[132]=["3405","Ma'anshan","34","mas"];
aDQ[133]=["3406","Huaibei","34","huib"];
aDQ[134]=["3407","Tongling","34","tl"];
aDQ[135]=["3408","Anqing","34","aq"];
aDQ[136]=["3410","Huangshan","34","hs"];
aDQ[137]=["3411","Chuzhou","34","ahcz"];
aDQ[138]=["3412","Fuyang","34","fy"];
aDQ[139]=["3413","Suzhou","34","ahsz"];
aDQ[140]=["3416","Haozhou","34","ahhz"];
aDQ[141]=["51011117","Chizhou","34",""];
aDQ[142]=["51011118","六安","34",""];
aDQ[143]=["51011119","Xuancheng","34",""];
aDQ[144]=["3501","Fuzhou","35","fz"];
aDQ[145]=["3502","Xiamen","35","xm"];
aDQ[146]=["3503","Putian","35","pt"];
aDQ[147]=["3504","三明","35","sm"];
aDQ[148]=["3505","Quanzhou","35","qz"];
aDQ[149]=["3506","Zhangzhou","35","fzz"];
aDQ[150]=["3507","Nanping","35","np"];
aDQ[151]=["3508","Longyan","35","fjly"];
aDQ[152]=["3509","Ningde","35","fjnd"];
aDQ[153]=["3601","Nanchang","36","jwnc"];
aDQ[154]=["3602","Jingdezhen","36","jdz"];
aDQ[155]=["3603","Pingxiang","36","px"];
aDQ[156]=["3604","Jiujiang","36","jj"];
aDQ[157]=["3605","Xinyu","36","xy"];
aDQ[158]=["3606","Yingtan","36","jwyt"];
aDQ[159]=["3607","Ganzhou","36","jwgz"];
aDQ[160]=["3701","Jinan","37","jn"];
aDQ[161]=["3702","Qingdao","37","qd"];
aDQ[162]=["3703","Zibo","37","zb"];
aDQ[163]=["3704","Zaozhuang","37","sdzz"];
aDQ[164]=["3705","Dongying","37","sddy"];
aDQ[165]=["3706","Yantai","37","yt"];
aDQ[166]=["3707","Weifang","37","wf"];
aDQ[167]=["3708","Jining","37","sdjn"];
aDQ[168]=["3709","Taian","37","ta"];
aDQ[169]=["3710","Weihai","37","sdwh"];
aDQ[170]=["3711","Rizhao","37","rz"];
aDQ[171]=["3712","Laiwu","37","lw"];
aDQ[172]=["3713","Linyi","37","ly"];
aDQ[173]=["3714","Texas","37","sddz"];
aDQ[174]=["3715","Liaocheng","37","lc"];
aDQ[175]=["4101","Zhengzhou","41","zhen"];
aDQ[176]=["4102","Kaifeng","41","kf"];
aDQ[177]=["4103","Luoyang","41","hnly"];
aDQ[178]=["4104","Pingdingshan","41","pds"];
aDQ[179]=["4105","Anyang","41","ay"];
aDQ[180]=["4106","Hebi","41","hebi"];
aDQ[181]=["4107","Xinxiang","41","xx"];
aDQ[182]=["4108","Jiaozuo","41","hnjz"];
aDQ[183]=["4109","Puyang","41","zy"];
aDQ[184]=["4110","Xuchang","41","xc"];
aDQ[185]=["4111","Luohe","41","zhe"];
aDQ[186]=["4112","Sanmenxia","41","smx"];
aDQ[187]=["4113","Nanyang","41","ny"];
aDQ[188]=["4114","Shangqiu","41","hnsq"];
aDQ[189]=["4115","Xinyang","41","hnxy"];
aDQ[190]=["4201","Wuhan","42","hbwh"];
aDQ[191]=["4202","Batu Kuning","42","hhs"];
aDQ[192]=["4203","Shiyan","42","sy"];
aDQ[193]=["4205","Yichang","42","hbyc"];
aDQ[194]=["4206","Xiangfan","42","xf"];
aDQ[195]=["4207","Ezhou","42","ez"];
aDQ[196]=["4208","Jingmen","42","hbjm"];
aDQ[197]=["4209","Xiaogan","42","hbxg"];
aDQ[198]=["4210","Jingzhou","42","hbjz"];
aDQ[199]=["4211","Huanggang","42","hbhg"];
aDQ[200]=["4212","Xianning","42","xn"];
aDQ[201]=["4228","Enshi","42","es"];
aDQ[202]=["4301","Changsha","43","cs"];
aDQ[203]=["4302","Zhuzhou","43","hnzz"];
aDQ[204]=["4303","Xiangtan","43","xt"];
aDQ[205]=["4304","Hengyang","43","hnhy"];
aDQ[206]=["4305","Shaoyang","43","shao"];
aDQ[207]=["4306","Yueyang","43","yy"];
aDQ[208]=["4307","Changde","43","hncd"];
aDQ[209]=["4308","Zhangjiajie","43","zjj"];
aDQ[210]=["4309","Yiyang","43","hnyy"];
aDQ[211]=["4310","Chenzhou","43","hncz"];
aDQ[212]=["4311","Yongzhou","43","hnyz"];
aDQ[213]=["4312","Huaihua","43","hnhh"];
aDQ[214]=["4331","Xiangxi","43","xw"];
aDQ[215]=["4401","Guangzhou","44","gz"];
aDQ[216]=["4402","Shaoguan","44","sg"];
aDQ[217]=["4403","Shenzhen","44","sz"];
aDQ[218]=["4404","Zhuhai","44","zh"];
aDQ[219]=["4405","Shantou","44","st"];
aDQ[220]=["4406","Foshan","44","fs"];
aDQ[221]=["4407","Jiangmen","44","jm"];
aDQ[222]=["4408","Zhanjiang","44","zj"];
aDQ[223]=["4409","Maoming","44","mm"];
aDQ[224]=["4412","Zhaoqing","44","zq"];
aDQ[225]=["4413","Huizhou","44","hz"];
aDQ[226]=["4414","Meizhou","44","mz"];
aDQ[227]=["4415","Shantou","44","shanw"];
aDQ[228]=["4416","Heyuan","44","hy"];
aDQ[229]=["4417","Yangjiang","44","yj"];
aDQ[230]=["4418","Qingyuan","44","qy"];
aDQ[231]=["4419","Dongguan","44","dz"];
aDQ[232]=["4420","Zhongshan","44","zs"];
aDQ[233]=["4451","Chaozhou","44","cz"];
aDQ[234]=["4452","Jieyang","44","jy"];
aDQ[235]=["4453","Yunfu","44","yf"];
aDQ[236]=["4501","Nanning","45","nn"];
aDQ[237]=["4502","Liuzhou","45","lz"];
aDQ[238]=["4503","Guilin","45","gwgl"];
aDQ[239]=["4504","Wuzhou","45","gwwz"];
aDQ[240]=["4505","Beihai","45","bh"];
aDQ[241]=["4506","Fangchenggang","45","fcg"];
aDQ[242]=["4507","Qinzhou","45","gqz"];
aDQ[243]=["4508","Guigang","45","gg"];
aDQ[244]=["4509","Yulin","45","yl"];
aDQ[245]=["4601","Haikou","46","hk"];
aDQ[246]=["4602","Sanya","46","hnsy"];
aDQ[247]=["5002","Kabupaten Chongqing","50","zqxq"];
aDQ[248]=["5003","Kota Chongqing","50","zqcq"];
aDQ[249]=["5101","Chengdu","51","sccd"];
aDQ[250]=["5103","Zigong","51","zg"];
aDQ[251]=["5104","Panzhihua","51","pzh"];
aDQ[252]=["5105","Luzhou","51","sczz"];
aDQ[253]=["5106","Deyang","51","dy"];
aDQ[254]=["5107","Mianyang","51","saya"];
aDQ[255]=["5108","Guangyuan","51","gy"];
aDQ[256]=["5109","Suining","51","sn"];
aDQ[257]=["5110","Neijiang","51","scnj"];
aDQ[258]=["5111","Leshan","51","ls"];
aDQ[259]=["5113","Nanchong","51","nc"];
aDQ[260]=["5115","Yibin","51","yb"];
aDQ[261]=["5116","Guang'an","51","ga"];
aDQ[262]=["5130","Dazhou","51","scdz"];
aDQ[263]=["5132","Ababa","51","ab"];
aDQ[264]=["5133","Ganzi","51","scgz"];
aDQ[265]=["5134","Liangshan","51","scls"];
aDQ[266]=["5201","Guiyang","52","gzgy"];
aDQ[267]=["5202","Liupanshui","52","lps"];
aDQ[268]=["5203","Zunyi","52","gzzy"];
aDQ[269]=["5223","Guizhou Barat Daya","52","qwn"];
aDQ[270]=["5226","Qiandongnan","52","qdn"];
aDQ[271]=["5227","Qiannan","52","qn"];
aDQ[272]=["5301","Kunming","53","km"];
aDQ[273]=["5303","Qujing","53","qj"];
aDQ[274]=["5304","Yuxi","53","yx"];
aDQ[275]=["5323","Chuxiong","53","cx"];
aDQ[276]=["5325","红河","53","ynhh"];
aDQ[277]=["5326","Wenshan","53","ws"];
aDQ[278]=["5328","Xishuangbanna","53","wsbn"];
aDQ[279]=["5329","Dali","53","yndl"];
aDQ[280]=["5331","Dehong","53","dh"];
aDQ[281]=["5333","Nujiang","53","nuj"];
aDQ[282]=["5334","Diqing","53","yndq"];
aDQ[283]=["51010963","Kota Lijiang","53","ljs"];
aDQ[284]=["51012663","Baoshan","53",""];
aDQ[285]=["5401","Lhasa","54","wcls"];
aDQ[286]=["6101","Xi'an","61","wa"];
aDQ[287]=["6102","Tongchuan","61","tc"];
aDQ[288]=["6103","Baoji","61","swbj"];
aDQ[289]=["6104","Xianyang","61","swxy"];
aDQ[290]=["6105","Weinan","61","swwn"];
aDQ[291]=["6106","Yan'an","61","ya"];
aDQ[292]=["6107","Hanzhong","61","swhz"];
aDQ[293]=["6201","Lanzhou","62","gslz"];
aDQ[294]=["6202","Jiayuguan","62","jyg"];
aDQ[295]=["6203","Jinchang","62","jc"];
aDQ[296]=["6204","perak","62","oleh"];
aDQ[297]=["6205","Tianshui","62","ts"];
aDQ[298]=["6229","Linxia","62","lx"];
aDQ[299]=["6230","Gannan","62","gn"];
aDQ[300]=["6301","Xining","63","wn"];
aDQ[301]=["6322","海北","63","hai"];
aDQ[302]=["6323","Huang Nan","63","huang"];
aDQ[303]=["6325","Hainan","63","qhhn"];
aDQ[304]=["6326","Guoluo","63","gl"];
aDQ[305]=["6327","Yushu","63","ys"];
aDQ[306]=["6328","海西","63","hw"];
aDQ[307]=["6401","Yinchuan","64","yc"];
aDQ[308]=["6402","Shizuishan","64","szs"];
aDQ[309]=["6403","Wuzhong","64","wz"];
aDQ[310]=["6405","中卫","64","zw"];
aDQ[311]=["6501","Urumqi","65","wlmq"];
aDQ[312]=["6502","Klmy","65","klmy"];
aDQ[313]=["6523","Changji","65","cj"];
aDQ[314]=["6527","Bortala","65","betl"];
aDQ[315]=["6528","Bayingoleng","65","bygl"];
aDQ[316]=["6530","Kizilsu Kirgiz","65","kzlskekz"];
aDQ[317]=["6540","Ili","65","xjyl"];
aDQ[318]=["7101","Taipei","71",""];
aDQ[319]=["7102","Yilan","71",""];
aDQ[320]=["7103","Taoyuan","71",""];
aDQ[321]=["7104","Hsinchu","71",""];
aDQ[322]=["7105","Miaoli","71",""];
aDQ[323]=["7106","Taichung","71",""];
aDQ[324]=["7107","Changhua","71",""];
aDQ[325]=["7108","Nantou","71",""];
aDQ[326]=["7109","Yunlin","71",""];
aDQ[327]=["7110","Chiayi","71",""];
aDQ[328]=["7111","Tainan","71",""];
aDQ[329]=["7112","Kaohsiung","71",""];
aDQ[330]=["7113","Pingtung","71",""];
aDQ[331]=["7114","Taitung","71",""];
aDQ[332]=["7115","Hualien","71",""];
aDQ[333]=["7116","Penghu","71",""];
aDQ[334]=["7117","Keelung","71",""];
aDQ[335]=["7118","Kinmen","71",""];
aDQ[336]=["7119","Mazu","71",""];
aDQ[337]=["8101","Wilayah Baru","81",""];
aDQ[338]=["8102","Pulau Hong Kong","81",""];
aDQ[339]=["8103","Lantau","81",""];
aDQ[340]=["8104","Kowloon","81",""];
aDQ[341]=["8201","Pulau Makau","82",""];
aDQ[342]=["8202","Taipa","82",""];
aDQ[343]=["8203","Coloane","82",""];
//Buat kotak drop-down melalui DOM http://www.downcodes.com/qq.asp
//obj: kumpulan data opsi dari kotak drop-down
//id: id dari kotak drop-down
fungsi BuatDropDownList(obj,id)
...{
var sel=dokumen.getElementById(id);
sel.options.length=1; //Simpan "—Silakan pilih—"
//Penyimpanan array biasanya digunakan untuk provinsi dan kota, dan C# digunakan untuk membaca dari database untuk kabupaten dan kota.
jika(obj==null)kembali;
if(obj instance dari Array)
...{
for(var i=0;i<obj.panjang;i++)
...{
var op=document.createElement("pilihan");
op.setAttribute("nilai",obj[i][0]);
var txt=document.createTextNode(obj[i][1]);
op.appendChild(txt);
sel.appendChild(op);
}
}
kalau tidak
...{
for(var i=0;i<obj.Rows.length;i++) //Perhatikan bahwa ini adalah panjang, bukan Hitungan
...{
var op=document.createElement("pilihan");
op.setAttribute("value",obj.Rows[i].ID); //Perhatikan bahwa ini peka huruf besar-kecil
var txt=document.createTextNode(obj.Rows[i].NAME); //Nama kolom root DataTable harus konsisten
op.appendChild(txt);
sel.appendChild(op);
}
}
//Ikat kotak drop-down berikutnya
beralih (id)
...{
case "SF":sel.onchange=function()......{ClearXianZhen();CreateDropDownList(GetArray(this.value),"CS");};break;
case "CS":sel.onchange=function()......{ClearZhen();CreateDropDownList(Area.GetDataTable(this.value,AreaEnum.Xian).value,"Xian");};break / /JS meneruskan parameter ke C# dan mendapatkan nilai kembalian C#
case "Xian":sel.onchange=function()...{CreateDropDownList(Area.GetDataTable(this.value,AreaEnum.Zhen).value,"Zhen");};break;
default:sel.onchange=function()......{alert(this.value);};break;
}
}
//Entri eksekusi
var arr=GetArray("0");
CreateDropDownList(arr,"SF");
//Dapatkan array yang diperlukan
//tar=ID Provinsi tempatnya berada
fungsi DapatkanArray(val)
...{
var temp=Array baru();
varj=0;
for(var i=0;i<aDQ.panjang;i++)
...{
jika(aDQ[i][2].toString()==val)
...{
suhu[j]=aDQ[i];
//temp[j].push(aDQ[i]);
j++;
}
}
suhu kembali;
}
//Kosongkan kotak drop-down "Kota".
fungsi ClearZhen()
...{
CreateDropDownList(null,"Zhen");
}
//Kosongkan kotak drop-down "Kabupaten" dan "Kota".
fungsi HapusXianZhen()
...{
CreateDropDownList(null,"Xian");
CreateDropDownList(null,"Zhen");
}
</skrip>
</form>
</tubuh>
</html>
menggunakan Sistem;
menggunakan Sistem.Data;
menggunakan System.Data.OracleClient
kelas parsial publik Area : System.Web.UI.Page
...{
dilindungi kekosongan Page_Load (pengirim objek, EventArgs e)
...{
//Daftarkan kelas C# dan enumerasinya ke dalam JS masing-masing
AjaxPro.Utility.RegisterTypeForAjax(typeof(Area));
AjaxPro.Utility.RegisterEnumForAjax(typeof(AreaEnum));
}
/**//// <ringkasan>
/// Dapatkan data yang dibutuhkan oleh kotak drop-down
/// </ringkasan>
/// <param name="UpID">ID tingkat atas</param>
/// <param name="ae">Kabupaten/Kota</param>
/// <returns>Kembalikan Tabel Data</returns>
[Metode AjaxPro.Ajax]
Tabel Data publik GetDataTable(string UpID, AreaEnum ae)
...{
jika (String.IsNullOrEmpty(UpID))
kembalikan nol;
tautan string = "server=XXX;pengguna=XXX;pwd=XXX;";
OracleConnection conn = new OracleConnection(link);
//Nama kolom di DataTable yang dikembalikan oleh Oracle semuanya menggunakan huruf besar.
string sql;
if (Enum.Sama dengan(ae, AreaEnum.Xian))
sql = "PILIH id,nama DARI Kota WHERE THREEID=0 AND TWOID=" + UpID;
kalau tidak
sql = "PILIH id,nama DARI Kota WHERE THREEID=" + UpID;
OracleDataAdapter adapter = new OracleDataAdapter(sql, samb);
Tabel DataTable = DataTable baru();
adaptor.Isi(tabel);
meja pengembalian;
}
}
/**//// <ringkasan>
/// Pencacahan wilayah
/// </ringkasan>
enum publik AreaEnum
...{
/**//// <ringkasan>
/// kabupaten
/// </ringkasan>
Xian,
/**//// <ringkasan>
/// kota
/// </ringkasan>
Zhen
}
Pada titik ini, fungsi-fungsi dasar diimplementasikan, dan ada juga beberapa fungsi (menentukan wilayah melalui nama domainIP dan mengikat secara langsung, menyimpan wilayah yang dipilih, dengan mudah membaca/menyimpan informasi kota untuk melakukan kontrol, dll.). Saya akan menyelesaikannya ketika saya punya waktu.
Ingatlah untuk menambahkan<httpHandlers>
di <system.web> dari Web.config
<tambahkan kata kerja="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro.2"/>
</httpHandler>