public void show_data(int ID) { A_Handler = new DesignationHandler(); A1 = new Designation(); A1 = A_Handler.GetDesignationDetails(ID); txtDes_id.Text = A1.Des_id.ToString(); ddlReg_id.SelectedValue = A1.Reg_id.ToString(); txtDes_name.Text = A1.Des_name.ToString(); txtDes_code.Text = A1.Des_code.ToString(); DropDownList1.SelectedValue = A1.IsTeaching.ToString(); btnSubmit.Text = "Update"; btnReset.Text = "Cancel"; if (Request.QueryString["action"] == "del") { Label1.Text = "Are U Sure, U want to Delete a Record ?"; txtDes_id.ReadOnly = true; ddlReg_id.Enabled = false; txtDes_name.ReadOnly = true; txtDes_code.ReadOnly = true; DropDownList1.Enabled = true; btnSubmit.Text = "Delete"; } }
protected void btnShow_Click(object sender, EventArgs e) { fld = cboSearch.SelectedValue.ToString(); txt = txtSearch.Text; A_Handler = new DesignationHandler(); sql = "select * from " + Tbl_Name + " where " + fld + " like '" + txt + "%' "; //Grid1.DataSource = A_Handler.GetDesignationList(sql); //Grid1.DataBind(); SqlDataSource1.SelectCommand = sql; SqlDataSource1.DataBind(); if (Grid1.Rows.Count > 0) { lblRec.Text = "Total Records : " + Grid1.Rows.Count.ToString(); } else { lblRec.Text = "Record Not Found..."; } }
protected void btnSubmit_Click(object sender, EventArgs e) { A_Handler = new DesignationHandler(); A1 = new Designation(); //A1.Des_id = Convert.ToInt32(txtDes_id.Text); A1.Reg_id = Convert.ToInt32(ddlReg_id.SelectedValue); A1.Des_name = txtDes_name.Text; A1.Des_code = Convert.ToInt32(txtDes_code.Text); A1.IsTeaching = Convert.ToInt32(DropDownList1.Text); if (btnSubmit.Text == "Submit") { bool B = A_Handler.AddNewDesignation(A1); if (B == true) { Label1.Text = "Record Inserted"; MSG = "Record Inserted"; } else { Label1.Text = "Record Not Inserted"; MSG = "Record Not Inserted"; } } else if (btnSubmit.Text == "Update") { A1.Des_id = Convert.ToInt32(txtDes_id.Text); bool B = A_Handler.UpdateDesignation(A1); if (B == true) { Label1.Text = "Record Updated"; MSG = "Record Not Updated"; } else { Label1.Text = "Record Not Updated"; MSG = "Record Not Updated"; } } else if (btnSubmit.Text == "Delete") { A1.Des_id = Convert.ToInt32(txtDes_id.Text); bool B = A_Handler.DeleteDesignation(A1); if (B == true) { Label1.Text = "Record Deleted"; MSG = "Record Deleted"; } else { Label1.Text = "Record Not Deleted"; MSG = "Record Not Deleted"; } } //Response.Redirect("~/ADMIN/Designation_list.aspx?msg="+MSG); }