<%@ page language="c#" codebehind="webform1.aspx.cs" autoeventwireup="false" inherits="custommanager.company.webform1" %> function showmsg() </script> using system; namespace custommanager.company if(!page.ispostback) strconn = "server=localhost;database=custom;uid=custom;pwd=a;"; dropdownlist1.datasource = tb3; foreach(datarow row in tb1.rows) } } #region web 窗体设计器生成的代码 }
<!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: 104px" 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]));
}
}
}
{
alert(document.form1.dropdownlist1.value);
alert(document.form1.dropdownlist2.value);
}
</body>
</html>
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;
{
/// <summary>
/// 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)
{
// 在此处放置用户代码以初始化页面
{
}
dropdownlist1.attributes.add("onchange","ld();");
string strconn,strsql;
system.data.sqlclient.sqldataadapter da;
strsql = "select * from custom.bigcalling;";
da = new system.data.sqlclient.sqldataadapter(strsql,strconn);
datatable tb3 = new datatable();
da.fill(tb3);
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 = "";
{
label1.text = label1.text + row["bigcallid"] + "-" +row["smallcallid"] + "-"+row["smallcallname"] + ",";
override protected void oninit(eventargs e)
{
//
// codegen: 该调用是 asp.net web 窗体设计器所必需的。
//
initializecomponent();
base.oninit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void initializecomponent()
{
this.load += new system.eventhandler(this.page_load);
#endregion
}
}
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器