WebControl and JavaScript

Discussion in 'ASP .Net Web Controls' started by Mike, Jul 5, 2006.

  1. Mike

    Mike Guest

    Hi,

    I created a webControl that overrides the "Render" method that contains a
    pretty long javascript, which is finally rendered as follows:

    this.Page.RegisterStartupScript("Load" + this.ClientID,
    script.ToString());
    I would like to re-use this control in various other projects, but also
    would like to know whether it is possible to extract the very long
    JavaScript code in a ".js" file that would make reading the code much easier
    for anyone that wants to customize or debug my control. Do you know if I can
    do it? If so, could you please let me know how (or point me to article/web
    sites)?

    Thanks a lot.
    Mike
     
    Mike, Jul 5, 2006
    #1
    1. Advertising

  2. Mike

    Brock Allen Guest

    Consider WebResources if you're using ASP.NET 2.0.

    http://www.asp.net/QuickStart/aspnet/doc/extensibility.aspx#WR

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


    > Hi,
    >
    > I created a webControl that overrides the "Render" method that
    > contains a pretty long javascript, which is finally rendered as
    > follows:
    >
    > this.Page.RegisterStartupScript("Load" + this.ClientID,
    > script.ToString());
    > I would like to re-use this control in various other projects, but
    > also
    > would like to know whether it is possible to extract the very long
    > JavaScript code in a ".js" file that would make reading the code much
    > easier
    > for anyone that wants to customize or debug my control. Do you know if
    > I can
    > do it? If so, could you please let me know how (or point me to
    > article/web
    > sites)?
    > Thanks a lot.
    > Mike
     
    Brock Allen, Jul 5, 2006
    #2
    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. Guest
    Replies:
    2
    Views:
    750
  2. Luis Ramírez.

    Can a webcontrol (webcontrol.dll) have a configuration file?

    Luis Ramírez., Jul 5, 2004, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    212
    Luis Ramírez
    Jul 6, 2004
  3. Kasabaarde Sumta

    WebControl inside of WebControl and attaching events

    Kasabaarde Sumta, Dec 13, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    207
    Kasabaarde Sumta
    Dec 13, 2004
  4. Fabricio

    Custom webcontrol that references another webcontrol

    Fabricio, Sep 21, 2005, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    197
    Fabricio
    Sep 21, 2005
  5. Peter Morris [Air Software Ltd]

    WebControl with non-WebControl property

    Peter Morris [Air Software Ltd], Dec 7, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    144
    Peter Morris [Air Software Ltd]
    Dec 7, 2004
Loading...

Share This Page