找回密码
 注册
搜索
热搜: 回贴

.NET中实现无客户端联动菜单 (无刷新)

2009-12-13 13:29| 发布者: admin| 查看: 56| 评论: 0|原作者: 天仙子

◎<%@Pagelanguage="c#"......


<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="CustomManager.company.WebForm1" %>



WebForm1








runat="server">Label
runat="server">




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
{
///
/// WebForm1 的摘要说明。
///

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);
}

///
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
///

private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion

}
}

最新评论

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-30 01:33 , Processed in 0.137491 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

返回顶部