protected void gvLkDescription_RowUpdating(object sender, GridViewUpdateEventArgs e) { int rowIndex = e.RowIndex; string lkDescription = ((TextBox)gvLkDescription.Rows[rowIndex].FindControl("txtlkDesc")).Text; int recordId = Convert.ToInt32(((Label)gvLkDescription.Rows[rowIndex].FindControl("lblRecordId")).Text); LookupMaintenanceData.UpdateLkDescription(recordId, lkDescription); gvLkDescription.EditIndex = -1; BindLookupMaintenance(); BindLKDescription(); lblErrorMsg.Text = "Lookup description updated successfully"; txtDescription.Text = ""; }
protected void btnSubmit_Click(object sender, EventArgs e) { try { LookupMaintenanceData.AddLookups(Convert.ToInt32(ddlLkLookupViewname.SelectedValue.ToString()), txtDescription.Text); lblErrorMsg.Text = "View name details saved successfully"; gvLookup.PageIndex = 0; BindLookupMaintenance(); } catch (Exception ex) { lblErrorMsg.Text = ex.Message; } }
protected void BindViewName() { try { ddlLkLookupViewname.DataSource = LookupMaintenanceData.GetLookupsViewName(); ddlLkLookupViewname.DataValueField = "RecordId"; ddlLkLookupViewname.DataTextField = "Viewname"; ddlLkLookupViewname.DataBind(); ddlLkLookupViewname.Items.Insert(0, new ListItem("Select", "NA")); } catch (Exception ex) { lblErrorMsg.Text = ex.Message; } }
protected void BindGridWithSort() { recordId = Convert.ToInt32(ddlLkLookupViewname.SelectedValue.ToString() == "" || ddlLkLookupViewname.SelectedValue.ToString() == "NA" ? "0" : ddlLkLookupViewname.SelectedValue.ToString()); DataTable dt = new DataTable(); if (ddlLkLookupViewname.SelectedIndex == 0) { dt = LookupMaintenanceData.GetLkLookupDetails(0, cbActiveOnly.Checked); } else { dt = LookupMaintenanceData.GetLkLookupDetails(recordId, cbActiveOnly.Checked); } SortDireaction = CommonHelper.GridSorting(gvLookup, dt, SortExpression, SortDireaction != "" ? ViewState["SortDireaction"].ToString() : SortDireaction); }
protected void BindLKDescription() { try { recordId = Convert.ToInt32(ddlLkLookupViewname.SelectedValue.ToString() == "" || ddlLkLookupViewname.SelectedValue.ToString() == "NA" ? "0" : ddlLkLookupViewname.SelectedValue.ToString()); if (recordId == 0) { gvLkDescription.DataSource = null; } else { gvLkDescription.DataSource = LookupMaintenanceData.GetLookupsById(recordId); } gvLkDescription.DataBind(); } catch (Exception ex) { lblErrorMsg.Text = ex.Message; } }
protected void BindLookupMaintenance() { try { recordId = Convert.ToInt32(ddlLkLookupViewname.SelectedValue.ToString() == "" || ddlLkLookupViewname.SelectedValue.ToString() == "NA" ? "0" : ddlLkLookupViewname.SelectedValue.ToString()); if (ddlLkLookupViewname.SelectedIndex == 0 || recordId == 0) { gvLookup.DataSource = LookupMaintenanceData.GetLkLookupDetails(0, cbActiveOnly.Checked); } else { gvLookup.DataSource = LookupMaintenanceData.GetLkLookupDetails(recordId, cbActiveOnly.Checked); } gvLookup.DataBind(); } catch (Exception ex) { lblErrorMsg.Text = ex.Message; } }
protected void gvLookup_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { int rowIndex = e.RowIndex; int typeId = Convert.ToInt32(((Label)gvLookup.Rows[rowIndex].FindControl("lbltypeid")).Text); string lkDescription = ((TextBox)gvLookup.Rows[rowIndex].FindControl("txtDesc")).Text; int recordId = Convert.ToInt32(((Label)gvLookup.Rows[rowIndex].FindControl("lblrecordId")).Text); bool isActive = Convert.ToBoolean(((CheckBox)gvLookup.Rows[rowIndex].FindControl("chkActiveEdit")).Checked); LookupMaintenanceData.UpdateLookups(typeId, lkDescription, recordId, isActive); gvLookup.EditIndex = -1; //BindLookupMaintenance(); BindGrids(); lblErrorMsg.Text = "Lookup details updated successfully"; txtDescription.Text = ""; } catch (Exception ex) { lblErrorMsg.Text = ex.Message; } }