Calling a javascript to a user control
-
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.
-
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.
-
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!!
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
-
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
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>
-
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
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!!
-
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!!
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
-
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
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!!