This is a migrated thread and some comments may be shown as answers.

ArgumentOutOfRange Exception - Multiple Docks Issue

1 Answer 29 Views
Dock
This is a migrated thread and some comments may be shown as answers.
localman
Top achievements
Rank 1
localman asked on 14 Jan 2009, 02:14 AM
http://tinyurl.com/86m8m6

The above link takes you to a screen capture of the error im getting.  I've used the code from the example provided for dynamically loading/saving Dock's from a database.

I think I've narrowed the issue, but I'm not sure how to correct it.

What I've done is: For each type of dock I want to add, I have defined a ContentTemplate in an ascx (each one has their own ascx).

When a user clicks a linkbutton, one of the below 3 are triggered.
<asp:updatepanel runat="server" id="UpdatePanel1">  
    <triggers> 
        <asp:asyncpostbacktrigger controlid="AddType1DockLinkButton" eventname="Command" /> 
        <asp:asyncpostbacktrigger controlid="AddType2DockLinkButton" eventname="Command" /> 
        <asp:asyncpostbacktrigger controlid="AddType3DockLinkButton" eventname="Command" /> 
    </triggers> 
</asp:updatepanel> 

If, for instance, I trigger the AddType1DockLinkButton, it works fine and I can continue to click it and add as many as I want. But, as soon asI click one of the other types, it crashes.

I think it has something to do with either the AsyncPostBackTriggers or StartUpScripts that I'm registering.

Here's the code where I create the RadDock. (not the most beautiful at this point, I'm just trying to get it to work.

        private RadDock CreateRadDock(UIContent uiContent, int contentControlID)  
        {  
            RadDock dock = new RadDock();  
 
            // Use the ID from uiContent, which holds all contentcontrols.  
            dock.UniqueName = uiContent.ID.ToString(); //Guid.NewGuid().ToString();  
            dock.ID = string.Format("RadDock{0}", dock.UniqueName);  
            //dock.Text = string.Format("Added at {0}", DateTime.Now);  
            //dock.Width = Unit.Pixel(300);   
            dock.TitlebarContainer.Height = Unit.Pixel(35);  
            dock.EnableEmbeddedSkins = false;  
            dock.ContentContainer.Style.Add(HtmlTextWriterStyle.Overflow, "hidden");  
 
            switch (uiContent.ContentTypeID)  
            {  
                case 1:  
                    dock.Title = "Type1";  
                    dock.TitlebarTemplate = Page.LoadTemplate("~/UIControls/ContentTitleBar.ascx");  
                    dock.ContentTemplate = Page.LoadTemplate("~/contentcontrols/Type1.ascx");  
                    break;  
                case 2:  
                    dock.Title = "Type2";  
                    dock.TitlebarTemplate = Page.LoadTemplate("~/UIControls/ContentTitleBar2.ascx");  
                    dock.ContentTemplate = Page.LoadTemplate("~/contentcontrols/Type2.ascx");  
                    break;  
                case 3:  
                    dock.Title = "Type3";  
                    break;  
                default:  
                    dock.Title = "Untitled";  
                    break;  
            }  
 
            DockCommand editCommand = new DockCommand();  
            editCommand.CssClass = "rdEdit";  
            editCommand.Text = "Edit Settings";  
            dock.Commands.Add(editCommand);  
 
            dock.Commands.Add(new DockCloseCommand());  
            dock.Commands.Add(new DockExpandCollapseCommand());  
 
            dock.Command += new DockCommandEventHandler(dock_Command);  
 
            return dock;  
        } 

1 Answer, 1 is accepted

Sort by
0
Nikolay Raykov
Telerik team
answered on 16 Jan 2009, 01:08 PM
Hi Shane,

I could not reproduce your problem. I made a test page with 3 Link Buttons which all trigger an asynchronous postback and dynamically add a new RadDock control.
For convenience, I attached a video in which you can see that everything is working OK and I am able to add docks without a problem.

I suggest to open a support ticket and send us a sample working version so we could be able to help you.


Regards,
Nikolay Raykov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Dock
Asked by
localman
Top achievements
Rank 1
Answers by
Nikolay Raykov
Telerik team
Share this question
or