protected void btnSave_Click(object sender, EventArgs e) { // string CmCode = txtCustCategoryCode.Text.Trim().Split(Constants.splitseperator)[0].ToString().Trim(); TeamMaster _objDs = new TeamMaster(); _objDs.TMID = Convert.ToInt32(lblTMID.Text); _objDs.TNAME = txttname.Text.Trim(); _objDs.TDESC = txtdesc.Text.Trim(); _objDs.CIsActive = ChekActive.Checked; try { if (txttname.Text != "") { _objDs.CSave(); } MessageBox("Record saved successfully"); if (btnSave.Text == "Update") { BindGvCCDetail(); PnlAddCC.Visible = false; PnlCCDetails.Visible = true; btnSave.Text = "Save"; txttname.Text = ""; txtdesc.Text = ""; } else { BindGvCCDetail(); txttname.Text = ""; txtdesc.Text = ""; ChekActive.Checked = true; PnlAddCC.Visible = true; PnlCCDetails.Visible = false; } } catch { } }
protected void GrdCCDetails_RowDeleting(object sender, GridViewDeleteEventArgs e) { TeamMaster _objDs2 = new TeamMaster(); _objDs2.TMID = Convert.ToInt32(((Label)GrdCCDetails.Rows[e.RowIndex].FindControl("lblTMID")).Text); _objDs2.TNAME = ((Label)GrdCCDetails.Rows[e.RowIndex].FindControl("lblTMNAME")).Text; _objDs2.TDESC = ((Label)GrdCCDetails.Rows[e.RowIndex].FindControl("lbltdesc")).Text; _objDs2.CIsActive = Convert.ToBoolean(false); _objDs2.CIsDeleted = Convert.ToBoolean(true); try { _objDs2.CSave(); MessageBox("Your record is Deleted"); BindGvCCDetail(); PnlCCDetails.Visible = true; PnlAddCC.Visible = false; } catch { } }