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

RadDock Error in a page with master page 'null' is null or not an object.

2 Answers 152 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Martin Beeby
Top achievements
Rank 1
Martin Beeby asked on 30 Jul 2007, 05:03 PM

Please Note: This is a solution rather than a question.

On the following example:

http://www.telerik.com/DEMOS/ASPNET/Prometheus/Dock/Examples/MyPortal/DefaultCS.aspx

The following javascript error throws if you are using master pages:

Microsoft JScript runtime error: 'null' is null or not an object.

This is caused by the following line:

ScriptManager.RegisterStartupScript(dock, Me.[GetType](), "AddDock", String.Format("function _addDock() {{" & Chr(13) & "" & Chr(10) & "" & Chr(9) & "Sys.Application.remove_load(_addDock);" & Chr(13) & "" & Chr(10) & "" & Chr(9) & "$find('{1}').dock($find('{0}'));" & Chr(13) & "" & Chr(10) & "" & Chr(9) & "$find('{0}').doPostBack('DockPositionChanged');" & Chr(13) & "" & Chr(10) & "}};" & Chr(13) & "" & Chr(10) & "Sys.Application.add_load(_addDock);", dock.ClientID, DropDownZone.SelectedValue), True)

DropDownZone.SelectedValue is referenced which will return RadDockZone1 instead of the required RadDockZone1.ClientID.

There are a few solutions to this problem but i found the best one was to populate the Rad Dock selector at runtime.

Simply add the following code to the page load:

Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load  
        If Not Page.IsPostBack Then 
 
            For Each item As ListItem In DropDownZone.Items  
                Dim obj As Web.UI.Control = RadDockLayout1.FindControl(item.Value)  
                If obj IsNot Nothing Then 
                    item.Value = obj.clientID  
                End If 
            Next 
        End If 
    End Sub 
 

If a better solution is avalible please post it here.

2 Answers, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 31 Jul 2007, 07:53 AM
Hello Martin Beeby,

Thank you for your active effort in improving the quality of the products we offer. I believe the solution you suggested is the most appropriate one.

Best wishes,
Petya
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jake
Top achievements
Rank 1
answered on 06 Nov 2008, 05:36 PM
I just added the following in the javascript to grap the client ID:

 

 

 

var dock = $find('<%= RadDock1.ClientID %>');

 

Tags
Dock
Asked by
Martin Beeby
Top achievements
Rank 1
Answers by
Petya
Telerik team
Jake
Top achievements
Rank 1
Share this question
or