private void SaveData() { data = new WebUserControlMapsData(); data.mapsData.Add(TextBoxMapName.Text); data.mapsData.Add(TextBoxMapMapData.Text); data.mapsData.Add(TextBoxMapDenivelation.Text); data.mapsData.Add(LabelMapNameError.Text); data.mapsData.Add(LabelMapMapDataError.Text); data.mapsData.Add(LabelMapDenivelationError.Text); }
public void LoadData(WebUserControlMapsData other) { if (other.mapsData.Count != 6) // Number of text boxes and label error fields { throw new Exception("Opppsss"); } TextBoxMapName.Text = other.mapsData[0]; TextBoxMapMapData.Text = other.mapsData[1]; TextBoxMapDenivelation.Text = other.mapsData[2]; LabelMapNameError.Text = other.mapsData[3]; LabelMapMapDataError.Text = other.mapsData[4]; LabelMapDenivelationError.Text = other.mapsData[5]; SaveData(); }
protected void ButtonAddMap_Click(object sender, EventArgs e) { WebUserControlMaps m = (WebUserControlMaps)LoadControl("~/WebUserControlMaps.ascx"); m.ID = PlaceHolderMaps.Controls.Count.ToString() + "_Map"; PlaceHolderMaps.Controls.Add(m); List <WebUserControlMapsData> mapData = MapsData; // Get it out of the viewstate WebUserControlMapsData newData = new WebUserControlMapsData(); newData = m.Data; mapData.Add(newData); MapsData = mapData; }