首页
知识
文库
登录
|
注册
首页
最近更新
所有主题
我的主题
我的收藏
首页
·
知识
·
Label
编辑:
图片来源:网络
<%@ 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
}
} 本文作者:佚名 来源:http://www.bjcan.com
CIO之家 www.ciozj.com 微信公众号:imciow
免责声明:本站转载此文章旨在分享信息,不代表对其内容的完全认同。文章来源已尽可能注明,若涉及版权问题,请及时与我们联系,我们将积极配合处理。同时,我们无法对文章内容的真实性、准确性及完整性进行完全保证,对于因文章内容而产生的任何后果,本账号不承担法律责任。转载仅出于传播目的,读者应自行对内容进行核实与判断。请谨慎参考文章信息,一切责任由读者自行承担。
延伸阅读
也许感兴趣的
我们推荐的
主题最新
看看其它的
收藏至微信