protected void btnUpdate_Click(object sender, EventArgs e) { try { ImageButton imgEdit = (ImageButton)sender; GridViewRow cnt = (GridViewRow)imgEdit.NamingContainer; Session["Opera_Id"] = Convert.ToInt32(cnt.Cells[0].Text); EntityOperationMaster tblOpera = new OpeartionMasterBLL().SelectOperation(Convert.ToInt32(cnt.Cells[0].Text)); if (tblOpera != null) { ListItem Desig = ddlCategoryName.Items.FindByText(Convert.ToString(tblOpera.CatName)); ddlCategoryName.SelectedValue = Desig.Value; Session["Cat_Id"] = ddlCategoryName.SelectedValue; txtCatOperation.Text = tblOpera.OperationName; txtPrice.Text = Convert.ToString(tblOpera.Price); btnUpdate.Visible = true; BtnSave.Visible = false; MultiView1.SetActiveView(View2); } } catch (Exception ex) { lblMessage.Text = ex.Message; } }
protected void BtnEdit_Click(object sender, EventArgs e) { int lintCnt = 0; try { EntityOperationMaster entOpera = new EntityOperationMaster(); //entRoom.RoomId = Convert.ToInt32(txtRoomId.Text); entOpera.OperationId = Convert.ToInt32(Session["Opera_Id"]); entOpera.OperationName = txtCatOperation.Text; entOpera.OperationCategoryId = Convert.ToInt32(Session["Cat_Id"]); entOpera.Price = Convert.ToDecimal(txtPrice.Text); OpeartionMasterBLL objOtherAcc = new OpeartionMasterBLL(); lintCnt = objOtherAcc.Update(entOpera); if (lintCnt > 0) { GetOperationDetails(); lblMessage.Text = "Record Updated Successfully"; //this.programmaticModalPopup.Hide(); } else { lblMessage.Text = "Record Not Updated"; } MultiView1.SetActiveView(View1); } catch (Exception ex) { Commons.FileLog("frmDepartmentMaster - BtnEdit_Click(object sender, EventArgs e)", ex); } }
private void EditBindCategory() { try { DataTable tblCat = new OpeartionMasterBLL().GetAllCategoryName(); DataRow dr = tblCat.NewRow(); dr["CategoryId"] = 0; dr["CategoryName"] = "---Select---"; tblCat.Rows.InsertAt(dr, 0); ddlEditCategoryName.DataSource = tblCat; ddlEditCategoryName.DataValueField = "CategoryId"; ddlEditCategoryName.DataTextField = "CategoryName"; ddlEditCategoryName.DataBind(); } catch (Exception ex) { lblMessage.Text = ex.Message; } }