protected void ctlAddNew_Click(object sender, ImageClickEventArgs e) { ctlProgramModalPopupExtender.Show(); ctlProgramGrid.DataCountAndBind(); ctlProgramForm.ChangeMode(FormViewMode.Insert); UpdatePanelProgramForm.Update(); }
protected void ctlProgramGrid_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "UserEdit") { int rowIndex = ((GridViewRow)((ImageButton)e.CommandSource).NamingContainer).RowIndex; short programId = Convert.ToInt16(ctlProgramGrid.DataKeys[rowIndex].Value); ctlProgramForm.PageIndex = (ctlProgramGrid.PageIndex * ctlProgramGrid.PageSize) + rowIndex; ctlProgramForm.ChangeMode(FormViewMode.Edit); IList <SuProgram> programList = new List <SuProgram>(); SuProgram program = SuProgramService.FindByIdentity(programId); programList.Add(program); ctlProgramForm.DataSource = programList; ctlProgramForm.DataBind(); ctlProgramGrid.DataCountAndBind(); UpdatePanelProgramForm.Update(); ctlProgramModalPopupExtender.Show(); } if (e.CommandName == "Select") { int rowIndex = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).RowIndex; short programId = UIHelper.ParseShort(ctlProgramGrid.DataKeys[rowIndex].Value.ToString()); ctlProgramLanguageGrid.DataSource = SuProgramLangService.FindByProgramId(programId); ctlProgramLanguageGrid.DataBind(); if (ctlProgramLanguageGrid.Rows.Count > 0) { ctlSubmit.Visible = true; ctlProgramLangFds.Visible = true; ctlCancel.Visible = true; } else { ctlSubmit.Visible = false; ctlProgramLangFds.Visible = false; ctlCancel.Visible = false; } ctlProgramGrid.DataCountAndBind(); ctlProgramLanguageUpdatePanel.Update(); } }