web| Dropdown | dropdown list I did a three-level linkage drop-down list box, the background with WebService, the foreground with WebService behavior and background communication. Please make more suggestions to improve the experts.
Server end: (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 are required by the ASP.net Web Services Designer
InitializeComponent ();
}
#region Component Designer generated code
<summary>
Required to Designer support-do not modify
The contents is with the Code Editor.
</summary>
private void InitializeComponent ()
{
String DSN = configurationsettings.appsettings["Yitong"];
Con=new SqlConnection (DSN);
}
#endregion
<summary>
Clean up any 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);
String s= "Please select:";
while (Dr. Read ())
{
s = = "," +dr["type"]. ToString ();
}
return s;
}
Client Side (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 ");
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.