RegisterClientScriptBlock with rendered control?

Discussion in 'ASP .Net Building Controls' started by Martin, Aug 30, 2006.

  1. Martin

    Martin Guest


    Are there any issues using ClientScriptManager.RegisterClientScriptBlock in
    a rendered control?

    I'm calling this function within the overriden Render method of my
    WebControl, but nothing the script is not coming out in my page source.
    After calling RegisterClientScriptBlock, a call to
    IsClientScriptBlockRegistered confirms the script block is registered.

    Any ideas?

    Martin, Aug 30, 2006
    1. Advertisements

  2. Martin

    Teemu Keiski Guest

    Using these in render method is too late since form has already begun
    rendering (scrips to be rendered are sort of fixed at that point already).
    Do registration in OnPreRender/PreRender stage.
    Teemu Keiski, Aug 30, 2006
    1. Advertisements

  3. Martin

    Martin Guest

    Thanks Teemu

    Martin, Aug 31, 2006
  4. Martin

    msnews Guest

    Are you expecting to see something no the web page or just in the HTML

    Normally this will place a script reference in your code which you cannot
    see. Try placing a Javascript alert into the script to see if that is

    Brennan Stehling
    msnews, Sep 11, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.