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;
        }
        public void Map_UserControlButtonRemoveClicked(object sender, EventArgs e)
        {
            // TO DO cast..
            WebUserControlMaps toDel = (WebUserControlMaps)sender;

            if (toDel != null)
            {
                // Find the index of the control
                int indexToDel = PlaceHolderMaps.Controls.IndexOf(toDel);
                if (indexToDel >= 0)
                {
                    List <WebUserControlMapsData> mData = MapsData; // Get it out of the viewstate
                    mData.RemoveAt(indexToDel);
                    MapsData = mData;

                    LoadMapsControls();
                    LoadMapsEvents();
                }
            }
        }
        // Push the maps in the panelHolder again
        void LoadMapsControls()
        {
            List <WebUserControlMapsData> mData = MapsData; // Get it out of the viewstate

            if (mData != null)
            {
                PlaceHolderMaps.Controls.Clear();

                int countID = 0;
                foreach (WebUserControlMapsData m in mData)
                {
                    WebUserControlMaps map = (WebUserControlMaps)LoadControl("~/WebUserControlMaps.ascx");
                    map.LoadData(m);
                    map.ID = countID.ToString() + "_Map";
                    ++countID;

                    PlaceHolderMaps.Controls.Add(map);
                }
            }

            MapsData = mData;
        }
        public void Map_UserControlFieldChanged(object sender, EventArgs e)
        {
            WebUserControlMaps m = (WebUserControlMaps)sender;

            if (m != null)
            {
                // Find the control.
                int indexOfControl = PlaceHolderMaps.Controls.IndexOf(m);
                if (indexOfControl >= 0)
                {
                    List <WebUserControlMapsData> mData = MapsData; // Get it out of the viewstate

                    if (mData.Count <= indexOfControl)
                    {
                        throw new ExecutionEngineException("Ooopps");
                    }

                    mData[indexOfControl] = ((MapDataEventArgs)e).Data;
                    MapsData = mData;
                }
            }
        }