| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 453 人关注过本帖
标题:有人有办法把这个转为web自定义控件吗?
只看楼主 加入收藏
Bug多多
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2006-8-1
收藏
 问题点数:0 回复次数:0 
有人有办法把这个转为web自定义控件吗?

namespace Main.CRM
{
/// <summary>
/// CostAdd 的摘要说明。
/// </summary>
public class CostAdd : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DropDownList Plist;
protected System.Web.UI.WebControls.DropDownList Clist;
protected System.Web.UI.WebControls.DropDownList Palist;
string StrConn =System.Configuration.ConfigurationSettings.AppSettings["Db"];

private void Page_Load(object sender, System.EventArgs e)
{
SqlConnection MyConn=new SqlConnection(StrConn);
MyConn.Open();

if(!this.IsPostBack)
{
//HttpContext.Current.Response.Cookies["DropCookies"]="";
string StrSql="select * from _List_Province order by OderId";
SqlCommand MyComm=new SqlCommand(StrSql,MyConn);
SqlDataReader MyDr=MyComm.ExecuteReader();
this.Plist.DataSource=MyDr;
this.Plist.DataTextField="Province";
this.Plist.DataValueField="Province";
this.Plist.DataBind();
MyDr.Close();
HttpContext.Current.Session["DropCookies"]="P";
string _Province="辽宁";
B2(_Province);
string _City="大连";
B3(_City);
}
}
public void B2(string _Province)
{
SqlConnection MyConn=new SqlConnection(StrConn);
MyConn.Open();
string StrSql2="select * from _List_City where Province='"+_Province+"' order by OderId";
SqlCommand MyComm2=new SqlCommand(StrSql2,MyConn);
SqlDataReader MyDr2=MyComm2.ExecuteReader();

this.Clist.DataSource=MyDr2;
this.Clist.DataTextField="City";
this.Clist.DataValueField="City";
this.Clist.DataBind();
MyDr2.Close();
}
public void B3(string _City)
{
string Company="";
object _Company=HttpContext.Current.Session["Company"];
if(!object.Equals(_Company,null))
{
Company=_Company.ToString();
}
else
{
Company="RSE";
}

string Administrators="";
object _Administrators=HttpContext.Current.Session["EmployeeId"];
if(!object.Equals(_Administrators,null))
{
Administrators=_Administrators.ToString();
}
else
{
Administrators="000";
}
SqlConnection MyConn=new SqlConnection(StrConn);
MyConn.Open();
string StrSql3="select * from Partner where City='"+_City+"' and Company like '%"+Company+"%'";
if(Administrators!="000")
{
StrSql3+="and Administrators like '%"+Administrators+"%'";
}
SqlCommand MyComm3=new SqlCommand(StrSql3,MyConn);
SqlDataReader MyDr3=MyComm3.ExecuteReader();
this.Palist.DataSource=MyDr3;
this.Palist.DataTextField="PartnerName";
this.Palist.DataValueField="PartnerNo";
this.Palist.DataBind();
HttpContext.Current.Session["DropCookies"]="p";
}

#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Plist.SelectedIndexChanged += new System.EventHandler(this.Plist_SelectedIndexChanged);
this.Clist.SelectedIndexChanged += new System.EventHandler(this.Clist_SelectedIndexChanged);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void Plist_SelectedIndexChanged(object sender, System.EventArgs e)
{
HttpContext.Current.Session["DropCookies"]="P";
string _Province=this.Plist.SelectedValue;
B2(_Province);
string _City=this.Clist.SelectedValue;
B3(_City);

}

private void Clist_SelectedIndexChanged(object sender, System.EventArgs e)
{
HttpContext.Current.Session["DropCookies"]="p";
string _City=this.Clist.SelectedValue;
B3(_City);
}
}
}

搜索更多相关主题的帖子: private public 
2006-08-02 17:27
快速回复:有人有办法把这个转为web自定义控件吗?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016215 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved