Cannot position and resize dynamically created RadWindows

3 posts, 0 answers
  1. Michael
    Michael avatar
    43 posts
    Member since:
    Mar 2013

    Posted 10 Apr 2013 Link to this post

    I am creating rad windows from an external XML datasource. But I cannot affect the positioning or size. Below is my ASPX
    <div id="dashboardContainer">
                <div id="dbTitle">
                    <span>DSX Web Data Center</span>
                    <div id="dbMenu">
                        <ul id="dbMenuItems">
                                    <li>Open Workspace</li>
                                    <li>Create Workspace</li>
                                    <li>Most Recent Workspace</li>
                                </ul>
                    </div>
                </div>
                <div id="dbPanelContainer" runat="server">
                    <telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager>
                </div>
                <div id="dbDSXLogo"></div>
            </div>

    Below is my C#
    private void LoadDBPanels()
        {
             
            //Get Panel Information
            string xmlFile = "http://localhost/test/dbPanelsXML.xml";
            XmlTextReader reader = new XmlTextReader(xmlFile);
            //  Loop over the XML file
            while (reader.Read())
            {   
                //  Here we check the type of the node, in this case we are looking for element   
                if (reader.NodeType == XmlNodeType.Element)   
                {       
                    //  If the element is "profile"       
                    if (reader.Name == "panel")       
                    {
     
                        //Create panel
                        RadWindow panel = new RadWindow();
                        panel.OffsetElementID="dbPanelContainer";
                        panel.VisibleOnPageLoad = true;
                        panel.Width = new System.Web.UI.WebControls.Unit(reader.GetAttribute("PanelWidth"));
                        panel.Height = new System.Web.UI.WebControls.Unit(reader.GetAttribute("PanelHeight"));
                        panel.Title = reader.GetAttribute("PanelTitle");
                        panel.ID = reader.GetAttribute("PanelID");
                        panel.Top = new System.Web.UI.WebControls.Unit(reader.GetAttribute("PanelTop"));
                        panel.Left = new System.Web.UI.WebControls.Unit(reader.GetAttribute("PanelLeft"));
                        panel.VisibleStatusbar = false;
                        panel.RestrictionZoneID = "dbPanelContainer";
                        panel.NavigateUrl = "http://www.deslongchamps.me";
                        RadWindowManager1.Windows.Add(panel);      
                    }   
                }
            }//end while
     
             
        }

    Below is my XML Sample
    <?xml version="1.0" encoding="utf-8" ?>
    <panels>
      <panel>
        <PanelID>DBPanel1</PanelID>
        <PanelTitle>Panel 1</PanelTitle>
        <PanelWidth>0</PanelWidth>
        <PanelHeight>0</PanelHeight>
        <PanelTop>0px</PanelTop>
        <PanelLeft>0px</PanelLeft>
        <PanelData>1</PanelData>
        <PanelType>1</PanelType>
      </panel>
      <panel>
        <PanelID>DBPanel2</PanelID>
        <PanelTitle>Panel 1</PanelTitle>
        <PanelWidth>400</PanelWidth>
        <PanelHeight>1700</PanelHeight>
        <PanelTop>0</PanelTop>
        <PanelLeft>410</PanelLeft>
        <PanelData>1</PanelData>
        <PanelType>1</PanelType>
      </panel>
    </panels>

    Also, when you click on the window or drag the window, the elements drop down and to the left.

    Any help would be great!
  2. MasterChiefMasterChef
    MasterChiefMasterChef avatar
    152 posts
    Member since:
    Jan 2013

    Posted 10 Apr 2013 Link to this post

    Hi Michael,

    Try adding the 'set_behaviors' property to the panel in your C#. All client side API can be seen here: 
    http://www.telerik.com/help/aspnet-ajax/window-programming-radwindow-methods.html

    Hopefully this helps,
    Master Chief
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Michael
    Michael avatar
    43 posts
    Member since:
    Mar 2013

    Posted 11 Apr 2013 Link to this post

    The issue was in the way I was pulling in the values.

    private void LoadDBPanels()
        {
             
            XmlDocument doc=new XmlDocument();
            doc.Load(HttpContext.Current.Server.MapPath("dbPanelsXML.xml"));
            XmlNode root=doc.SelectSingleNode("//panels");
            XmlNodeList nodeList=root.SelectNodes("panel");
     
            foreach(XmlNode n in nodeList)
            {
                //Create panel
                        RadWindow panel = new RadWindow();
                        panel.OffsetElementID="dbPanelContainer";
                        panel.VisibleOnPageLoad = true;
                        panel.Width = new System.Web.UI.WebControls.Unit(n.SelectSingleNode("PanelWidth").InnerText);
                        panel.Height = new System.Web.UI.WebControls.Unit(n.SelectSingleNode("PanelHeight").InnerText);
                        panel.Title = n.SelectSingleNode("PanelTitle").InnerText;
                        panel.ID = n.SelectSingleNode("PanelID").InnerText;
                        panel.Top = new System.Web.UI.WebControls.Unit(n.SelectSingleNode("PanelTop").InnerText);
                        panel.Left = new System.Web.UI.WebControls.Unit(n.SelectSingleNode("PanelLeft").InnerText);
                        panel.NavigateUrl = n.SelectSingleNode("PanelData").InnerText;
                        panel.VisibleStatusbar = false;
                        panel.RestrictionZoneID = "dbPanelContainer";
                        RadWindowManager1.Windows.Add(panel);      
            }
    }
Back to Top