<% @ Page language = "c #" Codebehind = "WebForm1.aspx. cs" AutoEventWireup = "false" Inherits = "CustomManager. company. WebForm1" %>
<! Doctype html public "-// W3C // dtd html 4.0 Transitional // EN">
<HTML>
<HEAD>
<Title> WebForm1 </title>
<Meta content = "Microsoft Visual Studio. NET 7.1" name = "GENERATOR">
<Meta content = "C #" name = "CODE_LANGUAGE">
<Meta content = "JavaScript" name = "vs_defaultClientScript">
<Meta content = "http://schemas.microsoft.com/intellisense/ie5" name = "vs_targetSchema">
<LINK href = "../css/style.css" type = "text/css" rel = "stylesheet">
</HEAD>
<Body MS_POSITIONING = "GridLayout">
<Form id = "Form1" method = "post" runat = "server">
<Asp: dropdownlist id = "DropDownList1" style = "Z-INDEX: 101; LEFT: 40px; POSITION: absolute; TOP: 168px"
Runat = "server" ></asp: dropdownlist> <asp: label id = "Label1" style = "Z-INDEX: 102; LEFT: 328px; POSITION: absolute; TOP: export PX "runat =" server "> Label </asp: label>
<Asp: DropDownList id = "DropDownList2" style = "Z-INDEX: 104; LEFT: 40px; POSITION: absolute; TOP: 264px"
Runat = "server"> </asp: DropDownList> </form>
<Script LANGUAGE = "javascript">
Var str = document. getElementById ("Label1"). innerText;
Arr = str. split (",");
A = arr. length
Ar = new Array ()
For (I = 0; I <a; I ++ ){
Ar [I] = arr [I]. split ("-");
}
Onecount = ar. length;
Function ld (){
Document. Form1.DropDownList2. length = 0
Lid = Form1.DropDownList1. value;
For (I = 0; I <onecount; I ++ ){
If (ar [I] [0] = lid ){
Document. Form1.DropDownList2. options. add (new Option (ar [I] [2], ar [I] [1]);
}
}
}
Function showMsg ()
{
Alert (document. Form1.DropDownList1. value );
Alert (document. Form1.DropDownList2. value );
}
</Script>
</Body>
</HTML>
Using System;
Using System. Collections;
Using System. ComponentModel;
Using System. Data;
Using System. Drawing;
Using System. Web;
Using System. Web. SessionState;
Using System. Web. UI;
Using System. Web. UI. WebControls;
Using System. Web. UI. HtmlControls;
Namespace CustomManager. company
{
/// <Summary>
/// Summary of WebForm1.
/// </Summary>
Public class WebForm1: System. Web. UI. Page
{
Protected System. Web. UI. WebControls. DropDownList DropDownList1;
Protected System. Web. UI. WebControls. Label Label1;
Protected System. Web. UI. WebControls. DropDownList DropDownList2;
Static protected DataTable tb1;
Private void Page_Load (object sender, System. EventArgs e)
{
// Place user code here to initialize the page
If (! Page. IsPostBack)
{
}
DropDownList1.Attributes. Add ("onchange", "ld ();");
String strConn, strSql;
System. Data. SqlClient. SqlDataAdapter da;
StrConn = "server = localhost; database = custom; uid = custom; pwd = ;";
StrSql = "select * from custom. bigcalling ;";
Da = new System. Data. SqlClient. SqlDataAdapter (strSql, strConn );
DataTable fig = new DataTable ();
Da. Fill (FIG );
DropDownList1.DataSource = fig;
DropDownList1.DataTextField = "BIGCALLNAME ";
DropDownList1.DataValueField = "BIGCALLID ";
DropDownList1.DataBind ();
StrSql = "select * from custom. smallcalling ;";
Da = new System. Data. SqlClient. SqlDataAdapter (strSql, strConn );
Tb1 = new DataTable ();
Da. Fill (tb1 );
Label1.Text = "";
Foreach (DataRow row in tb1.Rows)
{
Label1.Text = Label1.Text + row ["BIGCALLID"] + "-" + row ["SMALLCALLID"] + "-" + row ["SMALLCALLNAME"] + ",";
}
}
# Code generated by region Web Form Designer
Override protected void OnInit (EventArgs e)
{
//
// CODEGEN: This call is required by the ASP. NET Web form designer.
//
InitializeComponent ();
Base. OnInit (e );
}
/// <Summary>
/// The designer supports the required methods-do not use the code editor to modify
/// Content of this method.
/// </Summary>
Private void InitializeComponent ()
{
This. Load + = new System. EventHandler (this. Page_Load );
}
# Endregion
}
}