📄 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();//绑定供应商
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")//判断输入的编号是不是供应商编号
{
if(r.RequestInsert("supplycontact",Request)==1)
{
lblWarning.Text=aid.Text+"的信息添加成功!";
ClearTextBox();
}
else
{
lblWarning.Text=r.ErrMsg;
}
}
else
{
lblWarning.Text="请修改您输入的用户名,此种格式的名称为供应商信息中使用";
}
}
private void dbtnReset_Click(object sender, System.EventArgs e)
{
this.ClearTextBox();//调用父类的方法清空textbox
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -