or
private List<DockState> CurrentDockStates{ get { //Store the info about the added docks in the session. For real life // applications we recommend using database or other storage medium // for persisting this information. List<DockState> _currentDockStates = (List<DockState>)Session["CurrentDockStatesDynamicDocks"]; if (Object.Equals(_currentDockStates, null)) { _currentDockStates = new List<DockState>(); Session["CurrentDockStatesDynamicDocks"] = _currentDockStates; } return _currentDockStates; } set { Session["CurrentDockStatesDynamicDocks"] = value; }}private RadDock CreateRadDockFromState(DockState state){ RadDock dock = new RadDock(); try { dock.ID = string.Format("RadDock{0}", state.UniqueName); dock.ApplyState(state); dock.EnableRoundedCorners = true; dock.Command += new DockCommandEventHandler(dock_Command); dock.Commands.Add(new DockCloseCommand()); dock.Commands.Add(new DockExpandCollapseCommand()); var dockSaveCmd = new DockCommand(); dockSaveCmd.Name = "SaveToDB"; dockSaveCmd.Text = "Save"; dockSaveCmd.CssClass = "sdSaveCmd"; dockSaveCmd.OnClientCommand = "SaveStopToDB"; dock.Commands.Add(dockSaveCmd); } catch (Exception ex) { return null; throw new Exception(ex.Message, ex.InnerException); } return dock;}protected void Page_Init(object sender, EventArgs e){ //Recreate the docks in order to ensure their proper operation for (int i = 0; i < CurrentDockStates.Count; i++) { RadDock dock = CreateRadDockFromState(CurrentDockStates[i]); RadDockLayout1.Controls.Add(dock); CreateSaveStateTrigger(dock); }}private void CreateSaveStateTrigger(RadDock dock){ //Ensure that the RadDock control will initiate postback // when its position changes on the client or any of the commands is clicked. //Using the trigger we will "ajaxify" that postback. dock.AutoPostBack = true; dock.CommandsAutoPostBack = true; AsyncPostBackTrigger saveStateTrigger = new AsyncPostBackTrigger(); saveStateTrigger.ControlID = dock.ID; saveStateTrigger.EventName = "DockPositionChanged"; UpdatePanel1.Triggers.Add(saveStateTrigger); saveStateTrigger = new AsyncPostBackTrigger(); saveStateTrigger.ControlID = dock.ID; saveStateTrigger.EventName = "Command"; UpdatePanel1.Triggers.Add(saveStateTrigger);}void dock_Command(object sender, DockCommandEventArgs e){ if (e.Command.Name == "Close") { ScriptManager.RegisterStartupScript( UpdatePanel1, this.GetType(), "RemoveDock", string.Format(@"function _removeDock() {{ Sys.Application.remove_load(_removeDock); $find('{0}').undock(); $get('{1}').appendChild($get('{0}')); $find('{0}').doPostBack('DockPositionChanged'); }}; Sys.Application.add_load(_removeDock);", ((RadDock)sender).ClientID, UpdatePanel1.ClientID), true); } else if (e.Command.Name == "SaveToDB") { var dock = ((RadDock)sender); var stop = new Stop() { Id = int.Parse(dock.Tag), Name = ((RadTextBox)stopCtrl.FindControl("rtbName")).Text, Description = ((RadTextBox)stopCtrl.FindControl("TB_description")).Text, }; if (stop.Id < 0) { stop.Id = stop.Insert(); dock.Tag = stop.Id.ToString(); } else stop.Update(); }}protected void RadDockLayout1_LoadDockLayout(object sender, DockLayoutEventArgs e){ //Populate the event args with the state information. The RadDockLayout control // will automatically move the docks according that information. foreach (DockState state in CurrentDockStates) { e.Positions[state.UniqueName] = state.DockZoneID; e.Indices[state.UniqueName] = state.Index; }}protected void RadDockLayout1_SaveDockLayout(object sender, DockLayoutEventArgs e){ //Save the dock state in the page Session. This will enable us // to recreate the dock in the next Page_Init. CurrentDockStates = RadDockLayout1.GetRegisteredDocksState();}protected void RadButtonCreate_Click(object sender, EventArgs e){ var dock = new RadDock(); dock.DockMode = DockMode.Docked; dock.EnableRoundedCorners = true; dock.UniqueName = Guid.NewGuid().ToString(); dock.ID = string.Format("RadDock{0}", dock.UniqueName); dock.Tag = "-1"; StopFormTplEmpty widget = (StopFormTplEmpty)GlobalUtils.LoadControl(this, "~/Templates/StopFormTplEmpty.ascx"); widget.EnableViewState = true; dock.ContentContainer.Controls.Add(widget); dock.TitlebarTemplate = new DockTitleTemplate(dock, StopType.Unknown, "New"); dock.Width = Unit.Percentage(100); dock.Height = Unit.Pixel(420); dock.Commands.Add(new DockCloseCommand()); dock.Commands.Add(new DockExpandCollapseCommand()); var dockSaveCmd = new DockCommand(); dockSaveCmd.Name = "SaveToDB"; dockSaveCmd.Text = "Save"; dockSaveCmd.CssClass = "sdSaveCmd"; dockSaveCmd.OnClientCommand = "SaveStopToDB"; dock.Commands.Add(dockSaveCmd); dock.CommandsAutoPostBack = true; dock.Command += new DockCommandEventHandler(dock_Command); UpdatePanel1.ContentTemplateContainer.Controls.Add(dock); ScriptManager.RegisterStartupScript( dock, this.GetType(), "AddDock", string.Format(@"function _addDock() {{ Sys.Application.remove_load(_addDock); $find('{1}').dock($find('{0}'),{2}); $find('{0}').doPostBack('DockPositionChanged'); }}; Sys.Application.add_load(_addDock);", dock.ClientID, RadDockZoneStops.ID, 0), true); CreateSaveStateTrigger(dock);}
function GoogleEarthExtended() { var x = $("#ctl00_ContentPlaceHolder_Main_Wizard1_x").val(); var y = $("#ctl00_ContentPlaceHolder_Main_Wizard1_y").val(); var url = 'InsertGoogleEarthPhoto.aspx?type=roadmap' + '&x= ' + x + '&y= ' + y +'&hfGoogleMapsURLImage=' + document.getElementById("<%=hfGoogleMapsURLImage.ClientID%>").value +'&isHybrid=No'; var wnd = window.radopen(url); wnd.setSize(900, 600);}<asp:Button ID="butGoogleMap" runat="server" CssClass="but_lrg" Height="32px" OnClientClick="javascript:GoogleEarthExtended(); return false;" Text="Insert Google Earth Map" ToolTip="Insert a map of the property by using Google Earth." UseSubmitBehavior="False" Width="197px" />//Check if there is a URL to for the Google map image if (getParameterByName('hfGoogleMapsURLImage') != "") { //if there is ask a User if he wants to use the current Image but of type "RoadMap" var desc = confirm('Do you want to insert a roadmap version of the above satellite image?'); } else { var desc = false } //if the yes Choose Yes to use the RoadMap if (desc == true) { center = getParameterByName('center'); zoom = "15"; maptype = "roadmap"; x = getParameterByName('x'); y = getParameterByName('y'); //set the X and Y for Logic document.getElementById("Latitude").value = x; document.getElementById("Longitude").value = y; CloseWithArg(); }function CloseWithArg() { var customArg; if (getParameterByName('isHybrid') == "Yes") { // alert("inside first If"); customArg = document.getElementById("Latitude").value; //0 // alert("After x Assignment" + customArg); customArg = customArg + ";" + document.getElementById("Longitude").value; //1 //alert("After y Assignment" + customArg); customArg = customArg + ";" + map.getCenter(); // 2 //alert("After NA Assignment" + customArg); customArg = customArg + ";" + zoom; //3 //alert("After ZOOM Assignment" + customArg); customArg = customArg + ";" + "hybrid"; //4 //alert("After MAPTYPE Assignment" + customArg); customArg = customArg + ";" + getParameterByName('isHybrid'); //5 //alert("After IShybrid Assignment" + customArg); GetRadWindow().close(customArg); } else { //alert("Entered else"); //alert("X: " + document.getElementById("Latitude").value); //alert("Y: " + document.getElementById("Longitude").value); //alert("center: " + getParameterByName("center")); //alert("zoom: " + getParameterByName("zoom")); customArg = document.getElementById("Latitude").value; //0 customArg = customArg + ";" + document.getElementById("Longitude").value; //1 customArg = customArg + ";" + getParameterByName("center"); // 2 customArg = customArg + ";" + getParameterByName('zoom'); //3 customArg = customArg + ";" + "roadmap"; //4 customArg = customArg + ";" + "No"; //5 GetRadWindow().close(customArg); this.Close(); } }function GetRadWindow() { var oWindow = null; if (window.radWindow) oWindow = window.radWindow; else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; return oWindow;} function Close() { GetRadWindow().close();}GetRadWindow().close(customArg);function OnClientClick() { var IsCustomPageHeaderCheckBox = document.getElementById('<%= IsCustomPageHeaderCheckBox.ClientID %>'); var TemplateHeaderPanel = document.getElementById('<%= TemplateHeaderPanel.ClientID %>'); var editor = $find("<%=PageHeaderRadEditor.ClientID%>"); var selectedvalue = IsCustomPageHeaderCheckBox.checked; // getting the selected value if (selectedvalue == true) { TemplateHeaderPanel.style.display = 'none'; editor.set_mode(1); //Design mode editor.set_mode(2); //Html mode } else { TemplateHeaderPanel.style.display = 'block'; editor.set_mode(4); //Preview mode } }