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

3 posts, 0 answers
  1. Martin Beeby
    Martin Beeby avatar
    60 posts
    Member since:
    Nov 2006

    Posted 30 Jul 2007 Link to this post

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

    On the following example:


    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 
            End If 
        End Sub 

    If a better solution is avalible please post it here.

  2. Petya
    Petya avatar
    869 posts

    Posted 31 Jul 2007 Link to this post

    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,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Jake
    Jake avatar
    4 posts
    Member since:
    Sep 2007

    Posted 06 Nov 2008 Link to this post

    I just added the following in the javascript to grap the client ID:




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


Back to Top