Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Calling a javascript to a user control

Calling a javascript to a user control

Scheduled Pinned Locked Moved ASP.NET
javascriptquestion
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AnantAwadhut
    wrote on last edited by
    #1

    Hi all, I am having a user control, which is registered to the parent page during runtime. Now I want to add a javascript function to the user control. This javascript function has to called at page register? How this can be achieved? Thanks in advance.

    I 1 Reply Last reply
    0
    • A AnantAwadhut

      Hi all, I am having a user control, which is registered to the parent page during runtime. Now I want to add a javascript function to the user control. This javascript function has to called at page register? How this can be achieved? Thanks in advance.

      I Offline
      I Offline
      Ista
      wrote on last edited by
      #2

      Well a WUC is just like an include file so in your main Page call the Register method 1 line of code equals many bugs. So don't write any!!

      R 1 Reply Last reply
      0
      • I Ista

        Well a WUC is just like an include file so in your main Page call the Register method 1 line of code equals many bugs. So don't write any!!

        R Offline
        R Offline
        RichardGrimmer
        wrote on last edited by
        #3

        Hey there Ista....

        Ista wrote:

        just like an include file

        Have been trawling for an answer to this, but can't find any good info - is there a concept of an include file in HTML - for instance, can I put much used html elements into an include file, and add it to the page (and similarly, would be useful if I could "include" a js file in another js file).... Guess you're the guy to ask! "Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox

        E I 3 Replies Last reply
        0
        • R RichardGrimmer

          Hey there Ista....

          Ista wrote:

          just like an include file

          Have been trawling for an answer to this, but can't find any good info - is there a concept of an include file in HTML - for instance, can I put much used html elements into an include file, and add it to the page (and similarly, would be useful if I could "include" a js file in another js file).... Guess you're the guy to ask! "Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox

          E Offline
          E Offline
          E L Golpe
          wrote on last edited by
          #4

          Actually the concept of includes came from html, in what was called Server-Side-Includes (SSI pages.) Almost every web scripting language has the concept built-in today, but the first major implementation of includes came in Microsoft (Vermeer) FrontPage. Javascript can already be 'included' with the tag pointed to the .js file, and you could include from that particular .js file if your server is set to parse it for directives. If you going through this much trouble to hide JavaScript tho, you probably shouldn't be working with it in the first place. Work with server-side javascript or create downloadable smart-client applications. Practice sesquipedalianism! ;) -- modified at 11:10 Saturday 25th March, 2006</x-turndown>

          1 Reply Last reply
          0
          • R RichardGrimmer

            Hey there Ista....

            Ista wrote:

            just like an include file

            Have been trawling for an answer to this, but can't find any good info - is there a concept of an include file in HTML - for instance, can I put much used html elements into an include file, and add it to the page (and similarly, would be useful if I could "include" a js file in another js file).... Guess you're the guy to ask! "Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox

            I Offline
            I Offline
            Ista
            wrote on last edited by
            #5

            yeah. like Gol said you can specify that the js file to load. But, are you sure you want to be adding nested js files? I mean wont debugging be extremely annoying? But, if your defining objects like dymanic menus and stuff then it's okay. I would just be careful, cause even with script debuggers javascript is just plain annoying to debug. Nick 1 line of code equals many bugs. So don't write any!!

            R 1 Reply Last reply
            0
            • I Ista

              yeah. like Gol said you can specify that the js file to load. But, are you sure you want to be adding nested js files? I mean wont debugging be extremely annoying? But, if your defining objects like dymanic menus and stuff then it's okay. I would just be careful, cause even with script debuggers javascript is just plain annoying to debug. Nick 1 line of code equals many bugs. So don't write any!!

              R Offline
              R Offline
              RichardGrimmer
              wrote on last edited by
              #6

              Thanks for the advice guys, but think a little confusion....i'm ACUTELY aware that the script tag has a src attrib - what I'm asking is a) Can a .js be included from another .js and b) Can a similar thing be achieved using HTML.... For example - say that I have 5 .js' used in an HTML file....rather than 5

              1 Reply Last reply
              0
              • R RichardGrimmer

                Hey there Ista....

                Ista wrote:

                just like an include file

                Have been trawling for an answer to this, but can't find any good info - is there a concept of an include file in HTML - for instance, can I put much used html elements into an include file, and add it to the page (and similarly, would be useful if I could "include" a js file in another js file).... Guess you're the guy to ask! "Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox

                I Offline
                I Offline
                Ista
                wrote on last edited by
                #7

                well I dont believe you can embed js files within js files. There not used that so I would seriously doubt it You should prolly Create an HttpHandler. Then override the ProcessRequest and add your js into the request there. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcreatinghttphandlers.asp[^] That might be what your trying to do. I'm still kinda foggy what c++ has to do with this and why you have so much javascript? Nick 1 line of code equals many bugs. So don't write any!!

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups