protected void grdBooking_ItemCommand(object source, DataGridCommandEventArgs e) { try { string strCa = e.CommandArgument.ToString(); txtId.Text = e.CommandArgument.ToString(); if (e.CommandName == "Edit") { grdCustomer.DataSource = BookingService.Booking_GetById(strCa); grdCustomer.DataBind(); grdShopcard.DataSource = BookingService.Booking_GetById(strCa); grdShopcard.DataBind(); pnUpdate.Visible = true; pnView.Visible = false; } if (e.CommandName == "Delete") { BookingService.Booking_Delete(strCa); BindGrid(); } } catch (Exception ex) { WebMsgBox.Show(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { string id = Request.QueryString["idB"].ToString(); grdCustomer.DataSource = BookingService.Booking_GetById(id); grdCustomer.DataBind(); grdShopcard.DataSource = BookingService.Booking_GetById(id); grdShopcard.DataBind(); } catch (Exception ex) { WebMsgBox.Show(ex.Message); } } }