RegisterClientScriptBlock with rendered control?

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

  1. Martin

    Martin Guest

    Hi,

    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?

    Thanks
    Marti
     
    Martin, Aug 30, 2006
    #1
    1. Advertising

  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
    ASP.NET MVP, AspInsider
    Finland, EU
    http://blogs.aspadvice.com/joteke


    "Martin" <> wrote in message
    news:...
    > Hi,
    >
    > 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?
    >
    > Thanks
    > Marti
    >
    >
    >
     
    Teemu Keiski, Aug 30, 2006
    #2
    1. Advertising

  3. Martin

    Martin Guest

    Thanks Teemu

    "Teemu Keiski" <> wrote in message
    news:%...
    > 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
    > ASP.NET MVP, AspInsider
    > Finland, EU
    > http://blogs.aspadvice.com/joteke
    >
    >
    > "Martin" <> wrote in message
    > news:...
    >> Hi,
    >>
    >> 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?
    >>
    >> Thanks
    >> Marti
    >>
    >>
    >>

    >
    >
     
    Martin, Aug 31, 2006
    #3
  4. Martin

    msnews Guest

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

    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
    fired.

    Brennan Stehling
    http://brennan.offwhite.net/blog/

    "Martin" <> wrote in message
    news:...
    > Hi,
    >
    > 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?
    >
    > Thanks
    > Marti
    >
    >
    >
     
    msnews, Sep 11, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Leeor Chernov
    Replies:
    2
    Views:
    808
    Leeor Chernov
    Oct 16, 2005
  2. Replies:
    3
    Views:
    379
  3. Matt Sokol
    Replies:
    2
    Views:
    433
    Theo Tillotson
    Aug 7, 2003
  4. Cappy

    Repeater control in a rendered custom control

    Cappy, Jan 21, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    168
    Cappy
    Jan 21, 2004
  5. TJ
    Replies:
    4
    Views:
    388
    Steven Cheng[MSFT]
    Apr 7, 2006
Loading...

Share This Page