protected void dgLevel_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "AddNew") { dgLevel.FooterRow.Visible = true; } else if (e.CommandName == "Insert") { GlLevel glevel = new GlLevel(); glevel.LvlCode = ((TextBox)dgLevel.FooterRow.FindControl("txtLevelCode")).Text; glevel.LvlDesc = ((TextBox)dgLevel.FooterRow.FindControl("txtLevelDesc")).Text; glevel.LvlMaxSize = ((TextBox)dgLevel.FooterRow.FindControl("txtLevelMaxSize")).Text; glevel.LvlEnabled = ((DropDownList)dgLevel.FooterRow.FindControl("ddlLevelEnabled")).SelectedValue; glevel.LvlSegType = ((DropDownList)dgLevel.FooterRow.FindControl("ddlLevelSegType")).SelectedValue; glevel.LvlOrder = ((TextBox)dgLevel.FooterRow.FindControl("txtLevelOrder")).Text; LvlManager.InsertLevel(glevel); dgLevel.FooterRow.Visible = false; dgLevel.DataSource = LvlManager.GetLevels(); dgLevel.DataBind(); dgGlCoaGen.DataSource = LvlManager.GetLevelsGrid(); dgGlCoaGen.DataBind(); //ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script language=JavaScript>alert('Created Successfully! ');</script>"); } else { dgLevel.FooterRow.Visible = false; } }
protected void dgLevel_RowDeleting(object sender, GridViewDeleteEventArgs e) { LvlManager.DeleteLevel(((Label)dgLevel.Rows[e.RowIndex].FindControl("lblLevelCode")).Text); dgLevel.DataSource = LvlManager.GetLevels(); dgLevel.DataBind(); dgGlCoaGen.DataSource = LvlManager.GetLevelsGrid(); dgGlCoaGen.DataBind(); }
protected void dgLevel_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) { DataTable dtLvl = LvlManager.GetLevels(); dgLevel.EditIndex = -1; dgLevel.DataSource = dtLvl; dgLevel.DataBind(); }
protected void dgLevel_RowEditing(object sender, GridViewEditEventArgs e) { string le = ((Label)dgLevel.Rows[e.NewEditIndex].FindControl("lblLevelEnabled")).Text.ToString(); string ls = ((Label)dgLevel.Rows[e.NewEditIndex].FindControl("lblLevelSegType")).Text.ToString(); DataTable dtLvl = LvlManager.GetLevels(); dgLevel.EditIndex = e.NewEditIndex; dgLevel.DataSource = dtLvl; dgLevel.DataBind(); ((DropDownList)dgLevel.Rows[e.NewEditIndex].FindControl("ddlLevelEnabled")).SelectedIndex = ((DropDownList)dgLevel.Rows[e.NewEditIndex].FindControl("ddlLevelEnabled")).Items.IndexOf(((DropDownList)dgLevel.Rows[e.NewEditIndex].FindControl("ddlLevelEnabled")).Items.FindByValue(le)); ((DropDownList)dgLevel.Rows[e.NewEditIndex].FindControl("ddlLevelSegType")).SelectedIndex = ((DropDownList)dgLevel.Rows[e.NewEditIndex].FindControl("ddlLevelSegType")).Items.IndexOf(((DropDownList)dgLevel.Rows[e.NewEditIndex].FindControl("ddlLevelSegType")).Items.FindByValue(ls)); }
protected void dgLevel_RowUpdating(object sender, GridViewUpdateEventArgs e) { GlLevel lvl = LvlManager.getLevel(((TextBox)dgLevel.Rows[e.RowIndex].FindControl("txtLevelCode")).Text); lvl.LvlDesc = ((TextBox)dgLevel.Rows[e.RowIndex].FindControl("txtLevelDesc")).Text; lvl.LvlMaxSize = ((TextBox)dgLevel.Rows[e.RowIndex].FindControl("txtLevelMaxSize")).Text; lvl.LvlEnabled = ((DropDownList)dgLevel.Rows[e.RowIndex].FindControl("ddlLevelEnabled")).SelectedValue.ToString(); lvl.LvlSegType = ((DropDownList)dgLevel.Rows[e.RowIndex].FindControl("ddlLevelSegType")).SelectedValue.ToString(); lvl.LvlOrder = ((TextBox)dgLevel.Rows[e.RowIndex].FindControl("txtLevelOrder")).Text; LvlManager.UpdateLevel(lvl); DataTable dtLvl = LvlManager.GetLevels(); dgLevel.EditIndex = -1; dgLevel.DataSource = dtLvl; dgLevel.DataBind(); dgGlCoaGen.DataSource = LvlManager.GetLevelsGrid(); dgGlCoaGen.DataBind(); //ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script language=JavaScript>alert('Updated Successfully! ');</script>"); }
protected void Page_Load(object sender, EventArgs e) { try { if (Session["user"] == null) { Response.Redirect("Default.aspx"); } else { string pageName = DataManager.GetCurrentPageName(); string modid = PermisManager.getModuleId(pageName); per = PermisManager.getUsrPermis(Session["user"].ToString().Trim().ToUpper(), modid); if (per != null && per.AllowView == "Y") { ((Label)Page.Master.FindControl("lblLogin")).Text = Session["wnote"].ToString(); ((LinkButton)Page.Master.FindControl("lbLogout")).Visible = true; } else { Response.Redirect("Default.aspx"); } } } catch { Response.Redirect("Default.aspx"); } txtOpenDate.Attributes.Add("onBlur", "formatdate('" + txtOpenDate.ClientID + "')"); if (!IsPostBack) { DataTable dtLvl = LvlManager.GetLevels(); dgLevel.DataSource = dtLvl; dgLevel.DataBind(); dgGlCoaGen.DataSource = LvlManager.GetLevelsGrid(); dgGlCoaGen.DataBind(); Populate(); TreeView1.CollapseAll(); } }