當(dāng)前位置:工程項(xiàng)目OA系統(tǒng) > 泛普各地 > 上海OA系統(tǒng) > 上海OA信息化
一個(gè)用webservice behavior實(shí)現(xiàn)的三級(jí)聯(lián)動(dòng)下拉列表框
一個(gè)用webservice behavior實(shí)現(xiàn)的三級(jí)聯(lián)動(dòng)下拉列表框
我做了一個(gè)三級(jí)聯(lián)動(dòng)的下拉列表框,后臺(tái)用webservice,前臺(tái)用webservice
behavior與后臺(tái)通訊。請高手們多提改進(jìn)意見。
server端:(service1.asmx.cs)
using System;
using
System.Text;
using System.Configuration;
using
System.Collections;
using System.ComponentModel;
using
System.Data;
using System.Data.SqlClient;
using
System.Diagnostics;
using System.Web;
using
System.Web.Services;
namespace WebService1
{
///
<summary>
/// Summary description for Service1.
///
</summary>
public class Service1 :
System.Web.Services.WebService
{
SqlConnection con;
public Service1()
{
//CODEGEN: This call is
required by the ASP.NET Web Services
Designer
InitializeComponent();
}
#region Component Designer generated code
///
<summary>
/// Required method for Designer support - do not
modify
/// the contents of this method with the code editor.
///
</summary>
private void
InitializeComponent()
{
string dsn =
ConfigurationSettings.AppSettings["yitong"];
con=new
SqlConnection(dsn);
}
#endregion
/// <summary>
/// Clean up any resources being
used.
/// </summary>
protected override void Dispose( bool
disposing )
{
}
[WebMethod]
public string fenlei()
{
string
str="select distinct substring(code,1,3) as fenlei from jinan
";
SqlCommand cmd=new SqlCommand(str,con);
cmd.Connection.Open();
SqlDataReader
dr=cmd.ExecuteReader();
string s="請選擇:";
while(dr.Read())
{
s +=
","+dr["fenlei"].ToString();
}
return s;
}
[WebMethod]
public string leixing(string
q)
{
string str="select distinct type from jinan where code like
'"+q+"%'";
SqlCommand cmd=new SqlCommand(str,con);
cmd.Connection.Open();
SqlDataReader
dr=cmd.ExecuteReader();
string s="請選擇:";
while(dr.Read())
{
s +=
","+dr["type"].ToString();
}
return s;
}
[WebMethod]
public string haoduan(string
q)
{
string str="select distinct substring(code,4,4) as haoduan
from jinan where type='"+q+"'";
SqlCommand cmd=new SqlCommand(str,con);
cmd.Connection.Open();
SqlDataReader
dr=cmd.ExecuteReader();
string s="請選擇:";
while(dr.Read())
{
s +=
","+dr["type"].ToString();
}
return s;
}
client端(htmlpage1.htm)
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN"
>
<HTML>
<HEAD>
<META NAME="GENERATOR"
Content="Microsoft Visual Studio
7.0">
<TITLE></TITLE>
<script
id="clientEventHandlersJS" language="javascript">
<!--
var
icallid;
var icallid1;
var icallid2;
function window_onload()
{
service.useService("/service1.asmx?WSDL","myselect");
icallid=service.myselect.callService(fenlei,"fenlei");
}
function fenlei(result)
{
var
m=result.value;
var a=m.split(",")
for(var
i=0;i<a.length;i++)
{
window.s1.options=new
Option(a,a);
}
}
function s1_onchange() {
var
x=s1.value;
icallid1=service.myselect.callService(leixing,"leixing",x);
}
function s2_onchange() {
var
x=s2.value;
icallid2=service.myselect.callService(haoduan,"haoduan",x);
}
function leixing(result){
var m=result.value;
var
a=m.split(",")
window.s2.length=0;
for(var
i=0;i<a.length;i++)
{
window.s2.options=new
Option(a,a);
}
}
function haoduan(result){
var m=result.value;
var
a=m.split(",")
window.s3.length=0;
for(var
i=0;i<a.length;i++)
{
window.s3.options=new
Option(a,a);
}
}
//-->
</script>
</HEAD>
<BODY
onload="return window_onload()">
<div id="service"
style="behavior:url(webservice.htc)">
</div>
<select
id="s1" onchange="return s1_onchange()"> </select><select id="s2"
onchange="return s2_onchange()"></select>
<select
id="s3"></select>
</HTML>
- 1檔案上海OA信息化的主要觀點(diǎn)與創(chuàng)新、不足
- 2上海OA信息化與創(chuàng)新
- 3IT企業(yè)如何進(jìn)行上海OA信息化?
- 4OA辦公系統(tǒng)有其特殊性,又具有管理軟件的共性
- 5OA辦公系統(tǒng)軟件的獨(dú)有的辦公平臺(tái)和系統(tǒng)流程
- 6上海OA信息化落差于金融業(yè)風(fēng)險(xiǎn)管理專家系統(tǒng)
- 7成為上海OA信息化者的重要性
- 8供應(yīng)還是需求?社會(huì)性還是技術(shù)性?(by AMT 上海OA信息化小組編譯)
- 9使用Microsoft SOAP Toolkit 2.0建立安全Web服務(wù)
- 10上海隧道工程有限公司盾構(gòu)工程分公司辦公OA管理系統(tǒng)
- 11企業(yè)上海OA信息化領(lǐng)軍者之知識(shí)總監(jiān)
- 12KM和OA之異同
- 13泛普OA以不變應(yīng)萬變
- 14上海OA信息化與企業(yè)產(chǎn)品創(chuàng)新過程
- 15上海OA市場過去、未來
- 16上海OA信息化不神秘
- 17個(gè)人上海OA信息化與組織上海OA信息化
- 18如何對(duì)企業(yè)上海OA信息化進(jìn)行有效的評(píng)估分析
- 19.NET與SunONE 絕招盡顯
- 20上海OA信息化現(xiàn)在開始
- 21不同業(yè)務(wù)模式下的上海OA信息化策略
- 22Web服務(wù)到底是什么
- 23企業(yè)發(fā)展的知識(shí)動(dòng)因Vs.上海OA信息化三要素(by AMT 夏敬華 孟凡強(qiáng))
- 24交通行業(yè)上海OA信息化應(yīng)用的思考
- 25微軟亞洲程序大賽 北京航天航空大學(xué)奪冠
- 26上海麗漢貿(mào)易有限公司OA辦公系統(tǒng)平臺(tái)
- 27OA辦公系統(tǒng)收文管理:用于管理單位來文的簽收、擬辦、傳閱
- 28上海OA信息化:企業(yè)從優(yōu)秀到卓越
- 29Defining .NET and how to build a Client Application for a di
- 30OA辦公系統(tǒng)是最適合解決企業(yè)基礎(chǔ)管理問題管理軟件
成都公司:成都市成華區(qū)建設(shè)南路160號(hào)1層9號(hào)
重慶公司:重慶市江北區(qū)紅旗河溝華創(chuàng)商務(wù)大廈18樓
版權(quán)所有:泛普軟件 渝ICP備14008431號(hào)-2 渝公網(wǎng)安備50011202501700號(hào) 咨詢電話:400-8352-114