?? supplycontact.aspx.cs
字號:
using System;
using System.Data;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace NewGlassBook
{
/// <summary>
/// Summary description for employee.
/// </summary>
public class SupplyContact : MyPage
{
protected NewGlassBook.MyTextBox aid;
protected NewGlassBook.MyTextBox aPassword;
protected NewGlassBook.MyTextBox aName;
protected NewGlassBook.MyTextBox aMobile;
protected NewGlassBook.MyTextBox aTel;
protected NewGlassBook.MyTextBox aEmail;
protected NewGlassBook.MyDropDownList aSupplyID;
protected NewGlassBook.MyButton dbtnOk;
protected NewGlassBook.MyButton dbtnReset;
protected System.Web.UI.WebControls.Label lblWarning;
protected Record r;
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
bSupplyIDBind();//綁定供應(yīng)商
dbtnOk.Attributes["onClick"]="return supply_contactValid()";//客戶端驗證信息
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dbtnOk.Click += new System.EventHandler(this.dbtnOk_Click);
this.dbtnReset.Click += new System.EventHandler(this.dbtnReset_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void bSupplyIDBind()
{
r=new Record();
DataSet ds=r.GetData("supply","select * from supply where id<>'s0000' order by name asc");
aSupplyID.DataValueField="id";
aSupplyID.DataTextField="Name";
aSupplyID.DataSource=ds;
aSupplyID.DataBind();
ListItem li=new ListItem();
li.Text="";
li.Value="";
aSupplyID.Items.Insert(0,li);
}
private void dbtnOk_Click(object sender, System.EventArgs e)
{
r=new Record();
if(this.IsSupplyName(aid.Text)=="0")//判斷輸入的編號是不是供應(yīng)商編號
{
if(r.RequestInsert("supplycontact",Request)==1)
{
lblWarning.Text=aid.Text+"的信息添加成功!";
ClearTextBox();
}
else
{
lblWarning.Text=r.ErrMsg;
}
}
else
{
lblWarning.Text="請修改您輸入的用戶名,此種格式的名稱為供應(yīng)商信息中使用";
}
}
private void dbtnReset_Click(object sender, System.EventArgs e)
{
this.ClearTextBox();//調(diào)用父類的方法清空textbox
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -