RegisterClientScriptBlock code not executing.

Posted by ProfK on Stack Overflow See other posts from Stack Overflow or by ProfK
Published on 2010-04-12T11:31:01Z Indexed on 2010/04/12 11:33 UTC
Read the original article Hit count: 555

Filed under:
|
|

I'm using the following code in an attempt to show a dialog with a list of errors on the client:

    if (rollout.ImportErrors.Count > 0)
    {
        ClientScript.RegisterClientScriptBlock(GetType(), "showErrors", "showErrors();", true);
    }

The error count is non-zero and the following script block is emitted, but the script isn't executing.

<script type="text/javascript">
//<![CDATA[
$("#error-report").dialog("open")//]]>
</script>

If I call the function directly from a Firebug console window, the dialog shows properly, so I know the dialog and my code are working. What am I doing wrong?

BTW, this code is in a content page, using a content placeholder that 'injects' code into the element of the rendered page.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about ASP.NET