RegisterClientScriptBlock with rendered control?

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default RegisterClientScriptBlock with rendered control?

    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 Guest

  2. Similar Questions and Discussions

    1. RegisterClientScriptBlock does not work from a server control
      For some reason I cannot get RegisterClientScriptBlock to render a script reference on the page from a server control. Yes, I have not placed the...
    2. Repeater control in a rendered custom control
      I have created a custom control that puts a html wrapper around some code so <myc:cPanel ...>more html</myc:cPanel> will draw a html table which...
    3. ControlDesigner not invoked on custom control when control is rendered within another custom control
      I have a custom control that has a simple designer (derived from System.Web.UI.Design.ControlDesigner) associated with it (using the...
    4. control equivalent to Page.RegisterClientScriptBlock?
      I have a user control that can be created from a variety of other user controls. It is the same no matter where it is created from, and I only...
    5. problem with name created when control is rendered.
      Hello, I am creating a html server control that is in a datalist. I need to access this controls value on the client via javascript but the name...
  3. #2

    Default Re: RegisterClientScriptBlock with rendered control?

    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
    [url]http://blogs.aspadvice.com/joteke[/url]


    "Martin" <x@y.z> wrote in message
    news:emcAPlDzGHA.5048@TK2MSFTNGP05.phx.gbl...
    > 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 Guest

  4. #3

    Default Re: RegisterClientScriptBlock with rendered control?

    Thanks Teemu

    "Teemu Keiski" <joteke@aspalliance.com> wrote in message
    news:%23OmsNTFzGHA.4368@TK2MSFTNGP02.phx.gbl...
    > 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
    > [url]http://blogs.aspadvice.com/joteke[/url]
    >
    >
    > "Martin" <x@y.z> wrote in message
    > news:emcAPlDzGHA.5048@TK2MSFTNGP05.phx.gbl...
    >> 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 Guest

  5. #4

    Default Re: RegisterClientScriptBlock with rendered control?

    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
    [url]http://brennan.offwhite.net/blog/[/url]

    "Martin" <x@y.z> wrote in message
    news:emcAPlDzGHA.5048@TK2MSFTNGP05.phx.gbl...
    > 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 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139