Changing window clientidmode to static causes JavaScript error

4 posts, 0 answers
  1. mc2000
    mc2000 avatar
    48 posts
    Member since:
    Nov 2009

    Posted 18 Feb 2011 Link to this post

    Here is my RadWindow declaration:

    <telerik:RadWindow ID="VideoPlayerWindow" ClientIDMode="Static" runat="server" Modal="True" VisibleOnPageLoad="false" EnableShadow="true"
        Behaviors="Close" ReloadOnShow="true" AutoSize="true" OnClientBeforeClose="StopVideo">
        <ContentTemplate>
            <asp:UpdatePanel ID="VideoPlayerUpdatePanel" runat="server" UpdateMode="Always">
            <ContentTemplate>
            <uc1:ucVideo ID="Video1" runat="server" />
            </ContentTemplate>
            </asp:UpdatePanel>
        </ContentTemplate>
    </telerik:RadWindow>

    My previous JavaScript code to open the window was a little redundant if not messy (BEFORE SETTING CLIENTIDMODE = STATIC)

    ...
    if (clientId == "VideoPlayerWindow") { oWnd = $find("<%=VideoPlayerWindow.ClientID%>"); }
    ...

    I wanted to set the clientidmode to static and change the code to

    oWnd = $find(clientId);

    which returns a RadWindow object. When the window goes to open, however I get a JavaScript error and the window is blank:

    Microsoft JScript runtime error: 'this._contentElement.style' is null or not an object
    The line in ScriptResource:

    }

     

    if(this._dockMode){this._contentElement.style.width="1px";

    I am using the 2010.3.x version of the RadControls for ASP.NET. Thanks!

  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 21 Feb 2011 Link to this post

    Hi mc2000,

    Yes, we are familiar with this issue (there are several threads about this in the forums), however this behavior is expected. Microsoft recommends using ClientIDMode=Static only for static control. RadControls on the other hand are controls with complex hierarchies of child controls and templates so setting their ClientID mode to static will break their functionality.



    Kind regards,
    Georgi Tunev
    the Telerik team
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ziga HABJAN
    Ziga HABJAN avatar
    22 posts
    Member since:
    Jan 2004

    Posted 04 Mar 2015 Link to this post

    Will this be fixed? (I see no good reason why you couldn't make it work with a static clientid - it's just the "root" element id - and it does work in radgrid, which is probably more complex than window itself (hierarchy, templates, etc, ...))..
  5. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 04 Mar 2015 Link to this post

    Hello Ziga,

    There are plans to improve integration with ClientIDMode=Static, but I cannot offer an ETA at the moment. For the time being I advise against using it for any of our controls, as unpredictable issues may arise, even if things seem to work fine initially.

    Regards,

    Marin Bratanov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top