//protected void lnkbtnTitleTypeManage_Click(object sender, EventArgs e) //{ // BindingTitleType(); // pnListTitleType.Visible = true; // pnEditTitleType.Visible = false; // divInstrTitle.Attributes.Add("style", "display: none;"); // divTitleType.Attributes.Add("style", "display: block;"); //} protected void rptListrInstrTitle_ItemCommand(object source, RepeaterCommandEventArgs e) { CatalogTitleTypeBiz pBiz = new CatalogTitleTypeBiz(); lwg_InstrTitle p = pBiz.GetInstrTitleByID(int.Parse(e.CommandArgument.ToString())); if (e.CommandName.Equals("EDIT")) { if (p != null) { btnAddEditInstrTitle.Text = "Update"; lblTitleInstrTitle.Text = "Update InstrTitle"; HiddenField1.Value = e.CommandArgument.ToString(); pnEditInstrTitle.Visible = true; pnListInstrTitle.Visible = false; txtInstrTitleName.Text = p.Name; if (drpTitleType.Items.Count > 0) { drpTitleType.SelectedValue = p.TitleTypeId.ToString(); } } } else if (e.CommandName.Equals("DELETE")) { if (p != null) { if (pBiz.DeleteInstrTitle(p)) { BindingInstrTitle(); } } } }
protected void btnAddEditInstrTitle_Click(object sender, EventArgs e) { CatalogTitleTypeBiz pBiz = new CatalogTitleTypeBiz(); lwg_InstrTitle p; if (string.IsNullOrEmpty(HiddenField1.Value)) { p = new lwg_InstrTitle(); lblNoteAddeditInstrTitle.Text = "Insert error, please try again"; } else { p = pBiz.GetInstrTitleByID(int.Parse(HiddenField1.Value)); lblNoteAddeditInstrTitle.Text = "Update error, please try again"; } if (p != null) { p.Name = txtInstrTitleName.Text; if (drpTitleType.Items.Count > 0) { p.TitleTypeId = int.Parse(drpTitleType.SelectedValue); } if (pBiz.SaveInstrTitle(p)) { BindingInstrTitle(); txtInstrTitleName.Text = string.Empty; pnEditInstrTitle.Visible = false; pnListInstrTitle.Visible = true; return; } } lblNoteAddeditInstrTitle.Visible = true; }