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

invalid argument error when adding dynamic raddock

1 Answer 68 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Bob asked on 03 Aug 2009, 10:00 PM
I have a page based on the raddock example for storing raddock state into a database.
This has been working since Promethius but is raising an error "invalid argument" javascript exception at the line "_85.style.zIndex=this.originalZIndex;" every time I add a rad dock to the RadDockZone using the Q1 2009. 

I can't try q2 2009 because that is causing another error that I need to post.

Any help would be appreciated.

B


1 Answer, 1 is accepted

Sort by
0
Pero
Telerik team
answered on 06 Aug 2009, 07:45 AM
Hello Jed,

I think what might be causing the problem is that the originalZindex property of the RadDock is not initialized when the dock is added to the page and that's why JavaScript error is thrown. This however is fixed in the latest version of our controls and you can upgrade to it if you want.

To workaround this problem you can initialize the zIndex by adding the following code in the event handler method of the Button (Add Dock) Click event:

protected void ButtonAddDock_Click(object sender, EventArgs e) 
            RadDock dock = CreateRadDock(); 
            //In order to optimize the execution speed we are adding the dock to a  
            // hidden update panel and then register a script which will move it 
            // to RadDockZone1 after the AJAX request completes. If you want to  
            // dock the control in other zone, modify the script according your needs. 
            UpdatePanel1.ContentTemplateContainer.Controls.Add(dock); 
             
            //// This line is added $find('{0}').originalZIndex = '';  
            ScriptManager.RegisterStartupScript( 
            dock, 
            this.GetType(), 
            "AddDock"
            string.Format(@"function _addDock() {{
    Sys.Application.remove_load(_addDock);
    $find('{0}').originalZIndex = ''; 
    $find('{1}').dock($find('{0}'));
    $find('{0}').doPostBack('DockPositionChanged');
}};
Sys.Application.add_load(_addDock);", dock.ClientID, DropDownZone.SelectedValue), 
            true); 
 
            //Right now the RadDock control is not docked. When we try to save its state 
            // later, the DockZoneID will be empty. To workaround this problem we will  
            // set the AutoPostBack property of the RadDock control to true and will  
            // attach an AsyncPostBackTrigger for the DockPositionChanged client-side 
            // event. This will initiate second AJAX request in order to save the state 
            // AFTER the dock was docked in RadDockZone1. 
            CreateSaveStateTrigger(dock); 
 
            //Load the selected widget in the RadDock control 
            dock.Tag = DroptDownWidget.SelectedValue; 
            LoadWidget(dock); 
 
In case this does not fix the problem, please send us more information on which example exactly is your application based (because there are some modifications in the RadDock example SaveState in DB).



Greetings,
Pero
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Dock
Asked by
Bob
Top achievements
Rank 1
Answers by
Pero
Telerik team
Share this question
or