Output script

Discussion in 'ASP .Net Building Controls' started by Ahmed Hashish, Apr 6, 2005.

  1. I have created a server control and overridden the sub Render to output
    JavaScript functions, the problem that if the client used two instances of
    my control the control generates the JavaScript functions twice which cause
    a lot of problems, how could I solve this problem?


    Ahmed
     
    Ahmed Hashish, Apr 6, 2005
    #1
    1. Advertising

  2. Ahmed Hashish

    Brock Allen Guest

    Don'e emit javascript in Render. Instead call Page.RegisterClientScriptBlock
    from Page_Init or Page_Load.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > I have created a server control and overridden the sub Render to
    > output JavaScript functions, the problem that if the client used two
    > instances of my control the control generates the JavaScript functions
    > twice which cause a lot of problems, how could I solve this problem?
    >
    > Ahmed
    >
     
    Brock Allen, Apr 6, 2005
    #2
    1. Advertising

  3. Is there is a way to emit the script from my server control using function
    RegisterClientScriptBlock ?

    Ahmed



    "Brock Allen" <> wrote in message
    news:...
    > Don'e emit javascript in Render. Instead call
    > Page.RegisterClientScriptBlock from Page_Init or Page_Load.
    >
    > -Brock
    > DevelopMentor
    > http://staff.develop.com/ballen
    >
    >
    >
    >> I have created a server control and overridden the sub Render to
    >> output JavaScript functions, the problem that if the client used two
    >> instances of my control the control generates the JavaScript functions
    >> twice which cause a lot of problems, how could I solve this problem?
    >>
    >> Ahmed
    >>

    >
    >
    >
     
    Ahmed Hashish, Apr 7, 2005
    #3
  4. Ahmed Hashish

    Brock Allen Guest

    Yes, it's Page.RegisterClientScriptBlock -- "Page" is a property of your
    control that returns a reference to the containing page object.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > Is there is a way to emit the script from my server control using
    > function RegisterClientScriptBlock ?
    >
    > Ahmed
    >
    > "Brock Allen" <> wrote in message
    > news:...
    >
    >> Don'e emit javascript in Render. Instead call
    >> Page.RegisterClientScriptBlock from Page_Init or Page_Load.
    >>
    >> -Brock
    >> DevelopMentor
    >> http://staff.develop.com/ballen
    >>> I have created a server control and overridden the sub Render to
    >>> output JavaScript functions, the problem that if the client used two
    >>> instances of my control the control generates the JavaScript
    >>> functions twice which cause a lot of problems, how could I solve
    >>> this problem?
    >>>
    >>> Ahmed
    >>>
     
    Brock Allen, Apr 7, 2005
    #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. John Bentley

    Output / Debug window output bug?

    John Bentley, Sep 10, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    595
    John Bentley
    Sep 10, 2003
  2. chuck amadi
    Replies:
    1
    Views:
    491
    Larry Bates
    Jun 23, 2004
  3. Rajat
    Replies:
    3
    Views:
    704
    Jorgen Grahn
    Jan 8, 2010
  4. VYAS ASHISH M-NTB837
    Replies:
    2
    Views:
    565
    Jan Kaliszewski
    Jan 7, 2010
  5. Replies:
    4
    Views:
    189
    Josef Moellers
    Oct 27, 2007
Loading...

Share This Page