中国站长下载-为中国站长提供最好最全的建站资源! 首 页发布资源有事留言繁體中文
设为首页
加入收藏
联系我们
 
您当前的位置:中国站长下载 -> 文章中心 -> 网页编程 -> .NET编程 -> 文章内容  虚拟主机 域名注册 退出登录 用户管理
栏目导航
· ASP编程 · .NET编程
· PHP编程 · JSP编程
· CGI 专区
热门文章
· sndvol32 - sndvol3...
· [组图] FLASH:《大话李白》...
· 个人网站到底能赚多...
· [图文] Rundll.exe是病毒吗...
· [组图] Flash:制作MV
· 价值12万元的网站SE...
· 网站创业者,你需要...
· 一个成功的网站设计...
· [图文] FLASH:韩国导航条解...
· 中国网站的赚钱模式...
相关文章
· [图文] 清除恶意网站www.5x...
· [图文] 用ASP.NET 2.0设计网...
· [图文] 用ASP.NET 2.0设计网...
· [图文] 用ASP.NET 2.0设计网...
· [图文] 用ASP.NET 2.0设计网...
· [图文] 用ASP.NET 2.0设计网...
· ASP.NET中WebForm组...
· ASP.NET中WebForm组...
· ASP.NET中WebForm组...
· ASP.NET中WebForm组...
.NET中实现无客户端联动菜单
作者:未知  来源:CSDN  发布时间:2006-4-15 6:39:03  发布人:admin

 减小字体 增大字体

 

<%@ 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

  
 }
}


 
[] [返回上一页] [打 印] [收 藏]
∷相关文章评论∷    (评论内容只代表网友观点,与本站立场无关!) [更多评论...]
中国站长下载
中国站长下载

本页只接受PR>=4 IT类站点连接,申请连接,谢谢您们的支持!希望我们的下载站能够真正帮到中国的站长们!
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站地图
Copyright © 2005-2006 ChinaZhan.Net. All Rights Reserved .