protected void GrdDetails_RowDeleting(object sender, GridViewDeleteEventArgs e) { Masterofmaster _objMM = new Masterofmaster(); _objMM.AutoId = Convert.ToInt32(((Label)GrdDetails.Rows[e.RowIndex].FindControl("lblAutoID")).Text); _objMM.Value = ((Label)GrdDetails.Rows[e.RowIndex].FindControl("lblName")).Text; _objMM.key = ((Label)GrdDetails.Rows[e.RowIndex].FindControl("lblCode")).Text; _objMM.Group = ((Label)GrdDetails.Rows[e.RowIndex].FindControl("lblGroup")).Text; _objMM.Description = ((Label)GrdDetails.Rows[e.RowIndex].FindControl("lblDesc")).Text; _objMM.IsActive = ((CheckBox)GrdDetails.Rows[e.RowIndex].FindControl("chkIsActive")).Checked; _objMM.IsActive = Convert.ToBoolean(false); _objMM.IsDeleted = Convert.ToBoolean(true); try { _objMM.Save(); // MessageBox("Your record is Deleted"); BindGvDetail(); Panel1.Visible = false; Panel2.Visible = true; } catch { } }
protected void btnSave_Click(object sender, EventArgs e) { //setActiveUrl(); Masterofmaster _objMoM = new Masterofmaster(); _objMoM.AutoId = Convert.ToInt32(lblID.Text); _objMoM.key = txtkey.Text.Trim(); _objMoM.Value = txtvalue.Text.Trim(); _objMoM.Description = txtdecp.Text.Trim(); _objMoM.Group = Group; _objMoM.IsActive = chkActive.Checked; if (Group == "BookType") { _objMoM.BKID = Convert.ToInt32(DDLBMID.SelectedItem.Value); } // txtkey.Enabled = false; string strProductIDs = string.Empty; //if it is scheme { if (_objMoM.Group.ToLower() == "scheme".ToLower()) { foreach (ListItem i in chExtra.Items) { if (i.Selected == true) { strProductIDs += i.Value + ","; } } } } strProductIDs = strProductIDs + "0"; _objMoM.UpdatedBy = strProductIDs; try { if (lblID.Text == "0") { if (txtkey.Text != "") { _objMoM.Save(); } MessageBox("Record saved successfully"); txtkey.Text = ""; txtvalue.Text = ""; txtdecp.Text = ""; chkActive.Checked = false; filter.Visible = false; BindGvDetail(); Panel2.Visible = false; Panel1.Visible = true; btnSave.Text = "Save"; } else { if (lblID.Text != "0") { if (txtkey.Text != "") { _objMoM.Save(); } MessageBox("Record updated successfully"); chkActive.Checked = false; filter.Visible = true; BindGvDetail(); Panel2.Visible = true; Panel1.Visible = false; } } // filter.Visible = true; } catch { } }
protected void btnSave_Click(object sender, EventArgs e) { setActiveUrl(); Masterofmaster _objMoM = new Masterofmaster(); _objMoM.AutoId = Convert.ToInt32(lblID.Text); _objMoM.key = txtkey.Text.Trim(); _objMoM.Value = txtvalue.Text.Trim(); if (Group == "PVM") { _objMoM.Description = txtdecp.Text.Trim() + "#" + ddlMSOms.SelectedValue.ToString(); } else { _objMoM.Description = txtdecp.Text.Trim(); } _objMoM.Group = Group; _objMoM.IsActive = chkActive.Checked; // txtkey.Enabled = false; try { if (lblID.Text == "0") { if (txtkey.Text != "") { _objMoM.Save(); } MessageBox("Record saved successfully"); txtkey.Text = ""; txtvalue.Text = ""; txtdecp.Text = ""; chkActive.Checked = false; filter.Visible = false; BindGvDetail(); Panel2.Visible = false; Panel1.Visible = true; btnSave.Text = "Save"; } else { if (lblID.Text != "0") { if (txtkey.Text != "") { _objMoM.Save(); } MessageBox("Record updated successfully"); chkActive.Checked = false; filter.Visible = true; BindGvDetail(); Panel2.Visible = true; Panel1.Visible = false; } } // filter.Visible = true; } catch { } }