private String Check() { if (TxtName.Text == "") { MessageBox.Show("Please enter a name"); TxtName.Focus(); return("Error"); } else if (TxtDesignation.Text == "") { MessageBox.Show("Please enter a designation"); TxtDesignation.Focus(); return("Error"); } else if (TxtContact.Text == "") { MessageBox.Show("Please enter a contact no"); TxtContact.Focus(); return("Error"); } else if (TxtAddress.Text == "") { MessageBox.Show("Please enter a address"); TxtAddress.Focus(); return("Error"); } else { return("OK"); } }
protected void Page_Load(object sender, EventArgs e) { if (this.IsPostBack == false) { this.Form.DefaultButton = BtnAdd.UniqueID; TxtDesignation.Focus(); } }
private void ClearFields() { id = 0; TxtDescription.Text = ""; TxtDesignation.Text = ""; TxtMontant.Text = ""; TxtDesignation.Focus(); BtnDelete.Enabled = false; BtnSave.Enabled = true; }
protected void Page_Load(object sender, EventArgs e) { if (this.IsPostBack == false) { TxtDesignation.Focus(); this.Form.DefaultButton = BtnUpdate.UniqueID; MyJobPortalModel.Designation ObjDesignation = new MyJobPortalModel.Designation(int.Parse(Request.QueryString["Id"])); TxtDesignation.Text = ObjDesignation.DesignationName; DdlStatus.SelectedValue = ObjDesignation.Status; } }
protected void BtnUpdate_Click(object sender, EventArgs e) { if (this.IsValid == true) { bool AllOk = true; DataTable ObjDesignationTable = MyJobPortalModel.Designation.GetDesignationRecords("DesignationName ='" + TxtDesignation.Text.Replace("'", "''").Trim() + "' and Id<>" + Request.QueryString["Id"]); if ((int)ObjDesignationTable.Rows.Count > 0) { LblDuplicateDesignationError.Visible = true; AllOk = false; TxtDesignation.Focus(); return; } if (AllOk == true) { MyJobPortalModel.Designation ObjDesignation = new MyJobPortalModel.Designation(int.Parse(Request.QueryString["Id"])); ObjDesignation.DesignationName = TxtDesignation.Text.Replace("'", "''"); ObjDesignation.Status = DdlStatus.SelectedValue; ObjDesignation.Update(); Response.Redirect("DesignationList.aspx?Message=Record has been Updated"); } } }