kwilliams Posted September 11, 2006 Share Posted September 11, 2006 I'm a newbie to ASP.NET and VB.NET, and I'm trying to develop a way to include an external script file to a central ASP.NET page. After doing some research, I found information on the ClientScriptManager.RegisterClientScriptInclude Method at http://msdn2.microsoft.com/en-us/library/2552td66.aspx.So this is what I developed for my page: <%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" AspCompat="true" Debug="true" %><%@ import Namespace="System.Data" %><%@ import Namespace="System" %><%@ import Namespace="System.IO" %><%@ import Namespace="System.Xml" %><%@ import Namespace="System.Text.RegularExpressions" %><%@ import Namespace="System.Web.UI" %>Sub Page_Load(sender As Object, e As EventArgs)Dim page_path = page_qs 'Querystring variable unique to each pageDim vbkey As String = page_pathDim vbpath As String = "http://SERVERNAME/DIRECTORY/bgscripts/vb/vbdoc.vb"'Define the name, type and url of the client script on the page. Dim csname As String = vbkey Dim csurl As String = vbpath Dim cstype As Type = Me.GetType() ' Get a ClientScriptManager reference from the Page class. Dim cs As ClientScriptManager = Page.ClientScript ' Check to see if the include script is already registered. If (Not cs.IsClientScriptIncludeRegistered(cstype, vbkey)) Then cs.RegisterClientScriptInclude(cstype, vbkey, ResolveClientUrl(vbpath_new)) End IfEnd Sub But I'm receving this error message:Compiler Error Message: BC30002: Type 'ClientScriptManager' is not defined.I made sure to register the namespace at the top of the page (<%@ import Namespace="System.Web.UI" %>), but I'm still getting the same error. If anyone can help me to figure out what I'm doing wrong, that would be great. Thanks. Link to comment Share on other sites More sharing options...
aspnetguy Posted September 11, 2006 Share Posted September 11, 2006 what version of the .Net framework do you have installed? This a feature of 2.0 only. Link to comment Share on other sites More sharing options...
kwilliams Posted September 11, 2006 Author Share Posted September 11, 2006 what version of the .Net framework do you have installed? This a feature of 2.0 only.We have 2.0 installed. Link to comment Share on other sites More sharing options...
aspnetguy Posted September 11, 2006 Share Posted September 11, 2006 did you add the reference in VS (or VWD) Link to comment Share on other sites More sharing options...
kwilliams Posted October 2, 2006 Author Share Posted October 2, 2006 did you add the reference in VS (or VWD)Hi aspnetguy,Sorry that I didn't get back to your question sooner. This forum isn't emailing me even thought I've subscribed to the thread. I'm developing the site using Web Matrix, and I'm not sure how I would add a reference with that...or whether or not I need to. If you could give me more clarification on this, that would be great. Thanks. Link to comment Share on other sites More sharing options...
aspnetguy Posted October 2, 2006 Share Posted October 2, 2006 My first suggestion is, stop using Web Matrix...it is outdated and wasn't that good to begin with.Install .net framework 2.0 and download Visual Web Developer Express, it is free fromt he microsoft site. It is much better than Web Matrix.I don't use web matrix so I do not know how to add the reference either. Link to comment Share on other sites More sharing options...
kwilliams Posted October 2, 2006 Author Share Posted October 2, 2006 My first suggestion is, stop using Web Matrix...it is outdated and wasn't that good to begin with.Install .net framework 2.0 and download Visual Web Developer Express, it is free fromt he microsoft site. It is much better than Web Matrix.I don't use web matrix so I do not know how to add the reference either.I've been thinking of switching to VSE for a bit, so I appreciate your advice. I'll let you know how it goes. Thanks again. Link to comment Share on other sites More sharing options...
kwilliams Posted October 9, 2006 Author Share Posted October 9, 2006 My first suggestion is, stop using Web Matrix...it is outdated and wasn't that good to begin with.Install .net framework 2.0 and download Visual Web Developer Express, it is free fromt he microsoft site. It is much better than Web Matrix.I don't use web matrix so I do not know how to add the reference either.Well, I've installed Visual Web Developer 2005 Express Edition, and I really like it so far. Thanks for the suggestion.did you add the reference in VS (or VWD)I see how to add a reference to my site, but I don't know which reference to choose. There are two lists: .NET and COM. I've looked for "Client Script Manager" and "Register Client Script Include", but neither of them are on the lists. Could you help to point me in the right direction? Link to comment Share on other sites More sharing options...
aspnetguy Posted October 9, 2006 Share Posted October 9, 2006 You have to know what namespace they belong too. System.something..... Link to comment Share on other sites More sharing options...
jesh Posted October 9, 2006 Share Posted October 9, 2006 I see how to add a reference to my site, but I don't know which reference to choose. There are two lists: .NET and COM. I've looked for "Client Script Manager" and "Register Client Script Include", but neither of them are on the lists. Could you help to point me in the right direction?It's .NET. The file you are looking for is System.Web.dll. Link to comment Share on other sites More sharing options...
kwilliams Posted October 9, 2006 Author Share Posted October 9, 2006 It's .NET. The file you are looking for is System.Web.dll.I looked in the list of References in VWD2k5 by going to Website > Add Reference > .NET, but I did not find a file called System.Web.dll. Am I looking in the wrong place? Link to comment Share on other sites More sharing options...
jesh Posted October 9, 2006 Share Posted October 9, 2006 Are you certain that you are using .NET 2.0? I don't know about Visual Web Developer, but in Visual Studio, when I create a new Web Site, most, if not all, of the System DLLs are referenced automatically and don't show up in my bin directory.The Page class is in System.Web.UI, and all of the web controls (like <asp:Button />) are in System.Web.UI.WebControls. If you are able to access those classes then you have System.Web referenced correctly. Therefore, if you have System.Web referenced correctly, then you should be able to access ClientScriptManager unless you are not using 2.0. Link to comment Share on other sites More sharing options...
kwilliams Posted October 10, 2006 Author Share Posted October 10, 2006 I don;t think you have to manually add a refrence to System.Web...it should be done for you whne you start a new project.Just make sure you have C#using System.Web; At the top of your code, if using code behind. These are all of the namespaces I have referenced at the top of my page:<%@ import Namespace="System.Data" %><%@ import Namespace="System" %><%@ import Namespace="System.IO" %><%@ import Namespace="System.Xml" %><%@ import Namespace="System.Text.RegularExpressions" %><%@ import Namespace="System.Web.UI" %> ...so I should be covered, correct? But I still receive the same error message when attempting to call that method. Link to comment Share on other sites More sharing options...
aspnetguy Posted October 11, 2006 Share Posted October 11, 2006 I don;t think you have to manually add a refrence to System.Web...it should be done for you whne you start a new project.Just make sure you have C# using System.Web; At the top of your code, if using code behind. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now