private void RefreshGrid() { int AccomodationId = Convert.ToInt32(ddlAccomodation.SelectedValue); AccomodationContactsMaster oAccomodationContactMaster; AccomContactDTO[] oAccomodationContactData; oAccomodationContactMaster = new AccomodationContactsMaster(); oAccomodationContactData = oAccomodationContactMaster.GetAccomodationContacts(AccomodationId); if (oAccomodationContactData != null) { if (oAccomodationContactData.Length > 0) { dgAccomodationContacts.DataSource = oAccomodationContactData; dgAccomodationContacts.DataBind(); } } else { dgAccomodationContacts.DataSource = null; dgAccomodationContacts.DataBind(); } ClearPageControls(); oAccomodationContactMaster = null; oAccomodationContactData = null; }
protected void dgAccomodationContacts_SelectedIndexChanged(object sender, EventArgs e) { int iContactID = 0; int.TryParse(Convert.ToString(dgAccomodationContacts.DataKeys[dgAccomodationContacts.SelectedIndex]), out iContactID); hfId.Value = iContactID.ToString(); AccomodationContactsMaster oAccomodationContactMaster = new AccomodationContactsMaster(); AccomContactDTO[] oAccomodationContactData = oAccomodationContactMaster.GetAccomodationContacts(0, iContactID); if (oAccomodationContactData.Length > 0) { ddlAccomodation.SelectedIndex = oAccomodationContactData[0].AccomodationId; txtContactName.Text = oAccomodationContactData[0].ContactName; txtToIds.Text = oAccomodationContactData[0].ToId; txtCCIds.Text = oAccomodationContactData[0].CCId; txtBCCIds.Text = oAccomodationContactData[0].BCCId; if (oAccomodationContactData[0].MailOnBooking) { rdBookingYes.Checked = true; } else { rdBookingNo.Checked = true; } if (oAccomodationContactData[0].MailOnBookingUpdate) { rdBookingUpdatYes.Checked = true; } else { rdBookingUpdatNo.Checked = true; } if (oAccomodationContactData[0].MailOnBookingConfirmation) { rdConfirmationYes.Checked = true; } else { rdConfirmationNo.Checked = true; } if (oAccomodationContactData[0].MailOnBookingConfirmationUpdate) { rdConfirmationUpdateYes.Checked = true; } else { rdConfirmationUpdateNo.Checked = true; } if (oAccomodationContactData[0].MailOnCancellation) { rdCancellationYes.Checked = true; } else { rdCancellationNo.Checked = true; } if (oAccomodationContactData[0].MailOnDeletion) { rdDeletionYes.Checked = true; } else { rdDeletionNo.Checked = true; } } oAccomodationContactMaster = null; oAccomodationContactData = null; btnAddNew.Enabled = false; btnCancel.Enabled = true; btnDelete.Enabled = true; //btnEdit.Text = "Update"; btnSave.Text = "Update"; btnSave.Enabled = true; //btnEdit.Enabled = true; //btnSave.Enabled = false; lblStatus.Text = ""; }