In the ASCX file, put the TextBox control, as the input of the user and the password, and then put it into imagebutton, other few more other
Codebehind page:
Namespace gst.ui {using system.data; using system.drawing; using system.web; using system.web.ui.webcontrols; using system.web.ui.htmlControls;
///
// system declared protected System.Web.UI.WebControls.TextBox txtUser; protected System.Web.UI.WebControls.TextBox txtPass; protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1; protected System.Web.UI.WebControls.ImageButton Imgsubmit; protected system.web.ui.WebControls.RequidFieldValidator RequiredFieldValidator2;
// Declare delegate
Public Delegate Void EventHandler (Object Sender, Logineventargs E); Public Event EventHandler Loginsystem;
Public void onlineinsystem (logineventargs e) {if (loginsystem! = null) {loginsystem (this, e);}}
Private void page_load (object sender, system.eventargs e) {// Place user code here to initialize page //Response.write (this.FindControl ("tuser" ).Unique);}
#Region Web Form Designer Generated Code Override Protected Void OnNit (Eventargs E) {// // Codegen: This call is required for the ASP.NET Web Form Designer. // initializeComponent (); base.oninit (e);} ///
} #Endregion
Private void imgsubmit_click (object sender, system.web.ui.imageClickeventargs e) {
// trigger event this.onloginsystem (new logineventargs (txtuser.text);}}
///
Public logineventargs (string user, string pass) {_user = user; _pass = pass;
// account attribute public string user {get {return_user;} set {_user = value;}}
// Password property
PUBLIC STRING pass {get {return _pass;} set {_pass = value;
}
ASPX page call