Hi,
I want to dynamically insert a <script type="text/javascript" src="..."></script> into my <head></head> markups.
I've seen I have to use the method RegisterClientScriptInclude.
I'm in .net 2.0 in this project and this my code:
I've tested different solutions:
THe problem is that the script pages are not included.
This code is in my masterpage code behind. Those pages are useful in all pages which use this masterpage.
I've tried to insert this code in a content page, it does not work either.
The code is actually in a method which handles the Me.Load event.
If you have some solutions
thanks by advance
PS: I've already read the msdn documentation and some other websites on this subject.
I want to dynamically insert a <script type="text/javascript" src="..."></script> into my <head></head> markups.
I've seen I have to use the method RegisterClientScriptInclude.
I'm in .net 2.0 in this project and this my code:
VB.NET:
' Include some javascript external files
Dim jScript As ClientScriptManager = Page.ClientScript
jScript.RegisterClientScriptInclude(Me.GetType, "CoreApplication.js", jScript.GetWebResourceUrl(Me.GetType, Session("root") & "js/CoreApplication.js"))
jScript.RegisterClientScriptInclude(Me.GetType, "search.js", jScript.GetWebResourceUrl(Me.GetType, Session("root") & "js/search.js"))
I've tested different solutions:
- With the GetWebResourceUrl
- Without the GetWebResourceUrl
- With the first parameter (type)
- Without the first parameter
THe problem is that the script pages are not included.
This code is in my masterpage code behind. Those pages are useful in all pages which use this masterpage.
I've tried to insert this code in a content page, it does not work either.
The code is actually in a method which handles the Me.Load event.
If you have some solutions
thanks by advance
PS: I've already read the msdn documentation and some other websites on this subject.