Cannot read property 'style' of null

2 posts, 0 answers
  1. JP
    JP avatar
    122 posts
    Member since:
    Aug 2011

    Posted 19 Jul 2012 Link to this post


    I'm adding a RadWindow in the page's init event so I can use it to display async postback errors. But when I try to open the RadWindow on the client, I get the following javascript error:
    "Cannot read property 'style' of null" in this codeblock: 

    Thats my server-side code:

    RadWindow window = new RadWindow();
     window.ID = "AsyncErrorMessageWindow";
     window.ClientIDMode = ClientIDMode.Static;
     HtmlGenericControl contentDiv = new HtmlGenericControl("div");
     contentDiv.ID = "AsyncErrorMessageWindowContent";
     contentDiv.Attributes["class"] = "AsyncErrorMessageWindow_Content";
    and this is what I do client-side:

    function onEndRequest(sender, args) {
       // error handler
       if (args.get_error()) {
          var message = args.get_error().message;
          if (args.get_error().name === 'Sys.WebForms.PageRequestManagerServerErrorException') {
             if (args._error.httpStatusCode == 0) {
                return false;
          var window = $find('AsyncErrorMessageWindow');
          var windowContent = $('.AsyncErrorMessageWindow_Content');
       return true;

    Is there something I forgot? I'm using the RadWindow at other locations where it works fine.

    Thanks for your help!
  2. Marin Bratanov
    Marin Bratanov avatar
    5706 posts

    Posted 23 Jul 2012 Link to this post

    Hello JP,

    I advise that your remove the following line:
    window.ClientIDMode = ClientIDMode.Static;

    because the RadControls for ASP.NET AJAX do not support this mode (Static). Many of them are complex container structures and need the standard ID generation mechanism ASP provides and this is also the case with the RadWindow.

    Kind regards,
    Marin Bratanov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top