Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Docking > determine the position of dynamically created raddock
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Answered determine the position of dynamically created raddock

Feed from this thread
  • goldy avatar

    Posted on Dec 23, 2010 (permalink)

    Hello to all ..


    I have three rad dock which i am generating dynamically.In first dock there is image( at position-I) in IInd there is a text box(at position-II) and in third there is a label(at position-III)..


     string sql = "select ControlName,ControlDescription,ControlPath from Control where ControlId in(select ControlId from ControlZoneRelation where ZoneId=" + zone + ")"+"and ControlPath!='Null'";
            DataTable dt = new DataTable();
            dt = c1.SelectDT(sql, "dsf");
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    path = dt.Rows[i]["ControlPath"].ToString();
                    RadDock rad = new RadDock();
                    rad.DockMode = DockMode.Docked;
                    rad.UniqueName = path;
                    rad.Height = 50;
                    rad.Title = dt.Rows[i]["ControlDescription"].ToString();
                    rad.Width = Unit.Percentage(50);
                    DockCommand dd = new DockCommand();
                    dd.AutoPostBack = true;
                    dd.Text = "Preview";
                    dd.Name = dt.Rows[i]["ControlName"].ToString();
                    rad.Commands.Add(dd);
                    rad.Commands.Add(new DockCloseCommand());
                    Label ll = new Label();
                    ll.Text = dt.Rows[i]["ControlName"].ToString();
                    rad.ContentContainer.Controls.Add(ll);
                    RadDockZone1.Controls.Add(rad);              
                    rad.Command += new DockCommandEventHandler(rad_Command);

                    
                }


            }
        }


        void rad_Command(object sender, DockCommandEventArgs e)
        {
            RadDock rad1 = new RadDock();
            rad1.UniqueName = ((RadDock)sender).UniqueName;
            RadWindow newWindow = new RadWindow();
            newWindow.NavigateUrl = "raddockwind.aspx?Zoneid=" + rad1.UniqueName;
            newWindow.VisibleOnPageLoad = true;
            newWindow.Animation = WindowAnimation.FlyIn;
            newWindow.Width = 400;
            newWindow.Height = 300;
           
            RadWindowManager1.Windows.Add(newWindow);

        }


    Now suppose I change position of all the dock at run time means like image at II label at I and so on.....


    Now how i determine the position of dock so that when user made some changes and i can save their changed position..and i will save
    it in database..
    so that when user login again the position should come according to their last set position...


    plz help me
    Thanks 

  • Answer Pero Pero admin's avatar

    Posted on Dec 24, 2010 (permalink)

    Hello Goldy,

    I already answered to your question in the other thread you have opened, but I will also post my answer here. Here it is:

    The RadDock's Index property stores the 0-based position of the dock in the docking zone. The DockZoneID property stores the ClientID of the zone where the dock is docked to. The values of these two properties should be saved in order to reposition the dock at the correct position in the zone. The values should be stored in the RadDockLayout's SaveDockLayout event, and reassigned in the RadDockLayout's LoadDockLayout event. The following demos show how these events are used to load and save the state of dynamically created RadDock controls:
    Note that in both examples the docks are recreated in the Page.Init event. The LoadDockLayout event handler should look like the following (i.e. you should reassign the DockZoneID's and Indexes to the event argument parameters):
    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;
        }
    }


    All the best,
    Pero
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

  • goldy avatar

    Posted on Jan 10, 2011 (permalink)

    Thanks it works great

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Docking > determine the position of dynamically created raddock