网站首页站长博客下载中心域名交易站长论坛域名主机免费电邮免费域名中文排行排名查询站长书库书籍教程下载
设为首页
加入收藏
总编信箱
投稿或申请专栏请先 [登 陆]
学院首页 网络编程 网页设计 图形图象 数 据 库 服 务 器 网络媒体 网络安全 个人专栏 站长CLUB 业界新闻 信息公告
 当前位置:首页 >> 网络编程 >> NET专区 >> 正文
公告通知
返回上级列表
资料搜索
相关文章
用户自定义控件的应用
c#.net常用函数和方法集
在VB中使用水晶报表的一种简易编
C#调用父类的父类的方法
浏览.NET Framework 2.0 类型库中
为.Text Blog 添加 计数器
编程实现邮件地址有效性检测 
VB/VB.NET/C#导出到Excel的方法
c#高性能在WEB端产生验证图片
用System.Web.Caching.Cache保存
.NET中实现无客户端联动菜单
[ 来源:CSDN | 作者:未知 | 时间:2006-4-15 6:39:03 | 浏览:人次 ]
收藏到新浪ViVi 收藏到365KEY 收藏到我摘  字号选择〖    〗/ 双击滚屏 单击停止  
 

<%@ 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: 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]));   
    }   
  }  

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>
 /// 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)
  {
   // 在此处放置用户代码以初始化页面

   if(!Page.IsPostBack)
   {
    
   }
   DropDownList1.Attributes.Add("onchange","ld();");
   string strConn,strSql;
   System.Data.SqlClient.SqlDataAdapter da;
   

   strConn = "server=localhost;database=custom;uid=custom;pwd=a;";
   strSql = "select * from custom.bigcalling;";
   da = new System.Data.SqlClient.SqlDataAdapter(strSql,strConn);
   DataTable tb3 = new DataTable();
   da.Fill(tb3);

   DropDownList1.DataSource = 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 = "";

   foreach(DataRow row in tb1.Rows)
   {
    Label1.Text = Label1.Text  + row["BIGCALLID"] + "-" +row["SMALLCALLID"] + "-"+row["SMALLCALLNAME"] + ",";

   }

  }

  #region Web 窗体设计器生成的代码
  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

  
 }
}


[发送给好友]  [打印本页]  [关闭窗口]  [返回顶部]   转载请注明来源:http://edu.chinaz.com   
特别声明: 本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。
栏目编辑: 设计风 责任编辑: keke
原始作者: 未知 录入时间: 2006-4-15 6:39:03
信息来源: CSDN 投稿信箱: Edu#chinaz.com
设为首页 - 加入收藏 - 关于我们 - 广告服务 - 版权申明 - 友情链接 - 联系方式 - 总编信箱 - 会员投稿