/// <summary> /// handles the loading of the module setting for this /// control /// </summary> public override void LoadSettings() { try { if (!IsPostBack) { using (SelectedHotelsEntities db = new SelectedHotelsEntities()) { DropDownListTypes.DataSource = db.HotelTypes.ToList(); DropDownListTypes.DataBind(); object setting; setting = Settings["location"]; if (setting != null) { DNNTxtLocation.Text = setting.ToString(); } setting = Settings["distance"]; if (setting != null) { DropDownListDistance.SelectedValue = setting.ToString(); } setting = Settings["filter"]; if (setting != null) { TextBoxFilter.Text = setting.ToString(); } setting = Settings["hoteltype"]; if (setting != null) { DropDownListTypes.SelectedValue = setting.ToString(); } } } } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }
//function to load all types into dropdown list - dropdownlistTypes private void LoadTypes() { DataTable tab = new DataTable(); BLL obj = new BLL(); tab = obj.GetTypes(); if (tab.Rows.Count > 0) { DropDownListTypes.Items.Clear(); DropDownListTypes.DataSource = tab; DropDownListTypes.DataTextField = "QuestionType"; DropDownListTypes.DataValueField = "TypeId"; DropDownListTypes.DataBind(); DropDownListTypes.Items.Insert(0, "All"); } else { DropDownListTypes.Items.Insert(0, "- Input Question Types-"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //MessageWindowParameters messageWindowParameters = new MessageWindowParameters("Are you sure you wish to delete this item?", "Confirm Detele"); //cmdDelete.OnClientClick = Utilities.GetOnClientClickConfirm(ref cmdDelete, messageWindowParameters); cmdDelete.Attributes.Add("onClick", "javascript:return confirm('Are you sure you wish to delete this item?');"); using (SelectedHotelsEntities db = new SelectedHotelsEntities()) { DropDownListTypes.DataSource = db.HotelTypes.ToList(); DropDownListTypes.DataBind(); if (Request.QueryString["ItemId"] != null) { int id = int.Parse(Request.QueryString["ItemId"]); Hotel hotel = db.Products.Find(id) as Hotel; if (hotel != null) { cmdDelete.Visible = true; TextBoxName.Text = hotel.Name; TextBoxNumber.Text = hotel.Number; if (hotel.UnitCost.HasValue) { TextBoxUnitCost.Text = hotel.UnitCost.Value.ToString("#0.00"); } txtDescription.Text = hotel.Description; txtExtraDescription.Text = hotel.ExtraDescription; TextBoxURL.Text = hotel.URL; TextBoxImage.Text = hotel.Image; TextBoxRooms.Text = hotel.Rooms.ToString(); if (hotel.Star.HasValue) { TextBoxStar.Text = hotel.Star.Value.ToString("0.0"); } if (hotel.CustomerRating.HasValue) { TextBoxCustomerRating.Text = hotel.CustomerRating.Value.ToString("0.0"); } TextBoxAddress.Text = hotel.Address; TextBoxCurrencyCode.Text = hotel.CurrencyCode; if (hotel.Location != null && hotel.Location.Latitude.HasValue && hotel.Location.Longitude.HasValue) { TextBoxLat.Text = hotel.Location.Latitude.Value.ToString(); TextBoxLon.Text = hotel.Location.Longitude.Value.ToString(); } TextBoxPostCode.Text = hotel.PostCode; DropDownListTypes.SelectedValue = hotel.HotelTypeId.ToString(); RadGridAdditionalImages.Visible = true; } } else { RadGridAdditionalImages.Visible = false; } } } }