Properly Reference A JavaScript File In A Project?
Apr 16, 2010
I have some pages that reference javascript files.
The application exists locally in a Virtual Directory, i.e. http://localhost/MyVirtualDirectory/MyPage.aspx
so locally I reference the files as follows:
<script src="/MyVirtualDirectory/Scripts/MyScript.js" type="text/javascript"></script>
The production setup is different though. The application exists as its own web site in production, so I don't need to include the reference to the virtual directory. The problem with this is that I need to modify every file that contains a javascript reference so it looks like the following:
<script src="../Scripts/MyScript.js" type="text/javascript"></script>
I've tried referencing the files this way in my local setup but it doesn't work.
View 1 Replies
Similar Messages:
May 13, 2010
I have several web sites, all of which use the same JavaScript library. How can I "reference" this library from each of my web sites? If I just import the library into my web site in Visual Studio, I get in trouble as soon as the library changes, because I then have to update it in all web sites manually. It would be much easier to place the library in an external folder and just reference it from my web sites. How can I do this with Visual Studio?
View 9 Replies
Jul 7, 2010
I have a hquery plugin that consists of jquery itself, 2 .js files and some script to configure the plug-in which resides on the page. I noticed that in .net you can create a .js file.What I would like to do is put the configuration inside a .js file created in .net, but how do I then reference this in the header of the page?am I over complicating the issue or just missing something?
View 5 Replies
Mar 24, 2010
I have some pages that reference javascript files.
The application exists locally in a Virtual Directory, i.e. http://localhost/MyVirtualDirectory/MyPage.aspx
so locally I reference the files as follows:
<script src="/MyVirtualDirectory/Scripts/MyScript.js" type="text/javascript"></script>
The production setup is different though. The application exists as its own web site in production, so I don't need to include the reference to the virtual directory. The problem with this is that I need to modify every file that contains a javascript reference so it looks like the following:
<script src="../Scripts/MyScript.js" type="text/javascript"></script>
I've tried referencing the files this way in my local setup but it doesn't work.
View 3 Replies
Apr 21, 2010
I have a hquery plugin that consists of jquery itself, 2 .js files and some script to configure the plug-in which resides on the page. I noticed that in .net you can create a .js file.What I would like to do is put the configuration inside a .js file created in .net, but how do I then reference this in the header of the page
View 1 Replies
Jan 6, 2010
I wish to execute a javascript function in HTML Editor content. Hower, I give me the error "object expected". It seems like the browser cannot locate my javascript file.
Here is my setup:
- I have an external javascript file, "myscript.js" under "script" folder which has "test" function which contains a single "alert()" command.
- I referenced to "myscript.js" via <script src=....> tag (and also tried using Script manager's ScriptReference Path, same result).
- In my default.aspx page, I have a button which call "test" on mouseover event, which works call "test" correctly whenever I mouseover.
- In my default.aspx, I have the HTML Editor, with the this HTML content:
<span id="0001" onmouseover="alert('ok');">OK</span>
<span id="0002" onmouseover="test('not ok');">Not OK</span>
When I mouseover "ok" alert() script executed, but it give "object expected" error on I mouse over "not ok", it look like the browser cannot find "test" in myscript.js.
How do I reference this a script file inside the HTML Editor content?
View 6 Replies
Sep 29, 2010
I'm looking at an asp.net application, i notice that there are assemblies defined into two places. In web.config there is configuration/system.web/compilation/assemblies/add elements. In the project file there are references setup under the Project/ItemGroup/Reference elements.
I was wondering, what is the difference between assemblies/references added in either location?
View 1 Replies
Apr 2, 2010
Just using the class designer, now whenever I add a class through the class designer and double click it there is no namespace there. If I specify the namespace in the class code, when I go back into the class diagram the class disappears. Is there something I am doing wrong fellows ?
View 2 Replies
Sep 25, 2010
I'm just using a simple slideToggle function of jQuery. It works properly in my HTML file. But whenever I take codes into a ASP.NET WebForm project, script doesn't work. I can't achieve slide effect.
Is this a known issue? It's probably a popular mistake done by developers though. What could be the problem?
(I didn't copy&paste any code because of I thought this is not a specific situation, but I can show codes if you want)
View 2 Replies
Nov 29, 2010
I have an dought on adding name space in project. In one one of my project I want to add "System.SserviceModel.Web" name space. But the name space is not in .net tab of refence dialog box. How can I add this reference to the .net tab window?
View 2 Replies
Feb 28, 2011
For WPF, there's the Microsoft Patterns & Practices's Prism project.
Prism provides guidance designed to you more easily design and build rich, flexible, and easy-to-maintain
Windows Presentation Foundation (WPF) desktop applications, Silverlight Rich Internet Applications (RIAs), and Windows Phone 7 applications I was wondering whether a similar project (reference implementation) intended for software developers building WCF applications exists.
In our main internal project (a .Net WinForms rich client app), we don't talk directly with the database but instead fetch and update data with ASP.Net web-services that we also control. Our current setup is giving us some bottlenecks. For a new smallish project, we want to try WCF. Objective question: Where do I find a not-too-basic WCF reference project?
View 2 Replies
Jul 7, 2010
Before using any class in your website project/page we have to add it's assembly reference to our project. Right?
Now, when I am using SmtpClient class from System.Net assembly after adding the System.Net.Mail namespace in namespace node of application's web.config file but without adding assembly reference to the project it still accepting and running the code. Why?
I enquired the machine's web.config file located at C:WINDOWSMicrosoft.NETFrameworkv2.0.50727CONFIG but didnt find any assembly reference for System.Net.
how it is working and where the assembly reference has been added and how?
View 4 Replies
Mar 7, 2011
I have to show some functionality similar to accordion that is of jquery so i made a custom function of jquery to produce the effect. there is a grid view in which there are two div's here is the code.
<asp:GridView ID="grdAccordion" runat="server" AutoGenerateColumns="false" Width="200px">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<div class="myFirstDiv" onclick="testToggle(this)">
<%#Eval("Name")%>
<div class="mySecondDiv" style="display:none">
<%#Eval("Person_Name")%>
</div>
</div>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
The second div has style property display none. by default all the div are closed.
than i have made a js function that uses the toggle function to perform the action code.
function testToggle(testDiv) {
debugger
var sntHdnValue = $('#hdnSetFlag').val();
if (sntHdnValue == 1) {
$(testDiv).find('div:first').show().attr('isOpen', 'true');
}
else {
$(testDiv)
.parents('table:first')
.find('div[isOpen=true]').removeAttr('isOpen').toggle('slow');
$(testDiv).find('div:first').show().attr('isOpen', 'true');
}
sntHdnValue++;
$('#hdnSetFlag').val(sntHdnValue);
}
here i have made use of the hidden field that let's me know that it is the initial state every thing is closed i am adding a custom attr isopen for my identification
1)the current situation is this At load everty thing should be closed.
2)than at a time only single div should be open. this is working fine. The problem is if i click on the same div that i clicked to open than it has two custom attr isopen now it breaks the second case. how to solve it.
View 1 Replies
Apr 13, 2010
1. Is there a reason why someone would want to add a reference to an assembly (e.g. System.Drawing) but not add the Using statement? Seems that if you add a reference, you should add the Using statement automatically, but maybe not always?
2. Correct me if I'm wrong, the only benefit of adding a "Using" statement at the top of your file, is to bring into scope an assembly and not have to fully type the class name? So if I have a Using System.Drawing, I can type in
string = Color.Tomato.ToString(); instead of string = System.Drawing.Color.Tomato.ToString();
View 3 Replies
Jan 19, 2011
In my current project, I have a webservice file called MyServices.asmx. This webservice I want to reference in my Default.aspx.cs file.
My Code:
MyServices newService = new MyServices();
newService.addUser(txFirstName.Text, txLastName.Text, txtEmail.Text,
txtUserName.Text, txtPassword.Text, txtBalance.Text);
But when I refer to that webservice (as shown below), I get error saying: "The type or namespace name 'MyServices' could not be found (are you missing a using directive or an assembly reference?)"
What should I do to correct this error?
Current Solution of Adding Service Reference still gives me that error.
View 3 Replies
Feb 20, 2011
I have two projects in my solution: MyApp.Domain and MyApp.WebService. MyApp.WebService is a WCF service library. I want to use some utility functions from MyApp.Domain. So in MyApp.WebService, I added a reference to MyApp.Domain. Intellisense picked it up just fine, it recognized the function I need to call. But when I build the solution, I get this error:
The type or namespace name 'Domain' does not exist in the namespace 'MyApp' (are you missing an assembly reference?) at using MyApp.Domain.Utility;
What's going wrong here?
View 1 Replies
May 13, 2010
I'm working on an internet application that has been set up as a web SITE project (I know...) in Visual Studio. I need to add additional features/functionality so have added a class library to the project and referred to it in the main web site project.
The issue now arises because I need to make use of core objects which live inside the App_Code directory in the web site project but this project doesn't appear to expose its DLL like web app/ code library projects do. Because of this I can't add a reference to the web site project in the class library to leverage the common site-wide code/objects.
I can't move the stuff out of App_Code so I'm looking for a way to refer to the website project dll from the new class library.
View 3 Replies
Jun 18, 2010
My urls when I run the asp.net website project (in vs.net 2008) looks like:
http://localhost:54269/www/Default.aspx
So referencing things like:
/sytle/css.css
Doesn't seem to work.
Why does my project have a '/www' folder? Did I set things up wrong?
View 1 Replies
Jan 29, 2011
javascript - Why ClientValidationFunction function is not working properly
<script type="text/javascript">
function clientValidation(sender, arguments)
{
if (arguments.value == "hello world")
arguments.isvalid = true;
else
arguments.isvalid = false;
alert(arguments.isvalid);
}
</script>
<asp:Label ID="lblName" runat="server" Text="Enter Your Name" />
<asp:TextBox ID="txtbxName" runat="server" />
<asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="You are Not allowed" Display="None" ClientValidationFunction="clientValidation" ValidationGroup="ValidationSummary1" />
<br />
<asp:Label ID="lblClass" runat="server" Text="Class" />
<asp:TextBox ID="txtClass" runat="server" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please enter Clas" ControlToValidate="txtClass" Display="None" ValidationGroup="ValidationSummary1" />
<br />
<asp:ValidationSummary ValidationGroup="ValidationSummary1" ID="ValidationSummary1" runat="server" />
<br />
<asp:Button ID="Button1" runat="server" Text="Validate" ValidationGroup="ValidationSummary1" />
View 1 Replies
Mar 18, 2011
Does anyone know what could be the reason I am not able to add reference to System.Web. It gives an exclamation(!) symbol in front of the dll under reference folder in VS 1020. I wand to refer to System.Web.Security.MembershipProvider class.
View 1 Replies
Nov 25, 2010
I don't see any exact duplicates in the Related Questions above, so here goes. Please don't stone me if it is a duplicate.Is there any way to achieve the same end as setting 'Copy Local' to True on a web application reference? I could probably map a custom config section to the <compilation><assemblies> config section, and simple copy all assemblies to local, but that would be quite rude. Should I be looking at tapping into a build provider or something? I think the main issue here is identifying listed assemblies not normally present on the target platform, but this seems a very difficult task to me without simply using a hard-coded list,
View 2 Replies
Dec 13, 2010
I am using VS2010. When I am building a release for a WinForms Applicaiton, I can see some .xml files relevant to project in the bin elease folder. The .dll (third party component) has been referenced in the References folder of the project for eg. Rebex.Net.Ftp and in the properties window the Source Path is
C:Program FilesRebexFile Transfer Pack for .NET 4.0FTP SSL for .NET 4.0inRebex.Net.Ftp.dll In the above mentioned source path directory there is an Rebex.Net.Ftp.xml which gets pulled across to the release folder as well. I couldn't really get my head around where this can be referenced so that it puts this .xml file in the release folder of the project when I do a build?
My main problem is, when I created a setup project for this application, I can't get this file included in the installation pack (after installing the .msi file). I get the Rebex.Net.Ftp.dll but not Rebex.Net.Ftp.xml file. I tried all the options in the Project Output except including the "Source files" which I dont want to. how to include the .xml files in the setup installation pack, ie., if there are properties I am forgetting to set or something like that?
View 3 Replies
Sep 22, 2010
I am trying to copy code from one project to another. There is one problem however:
The type 'Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.Practices.EnterpriseLibrary.Data, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null'.
View 3 Replies
Sep 24, 2010
There is a C#.net libraray project whose dll name is customer.dll. It has a class name customer with a function name show(). I want to call this function from another project but dont want to add reference to the caller project. Can this be done? Is there any C#.net class that can acheive this?
View 1 Replies
Jun 11, 2010
I defined a few display templates for classes and they work well when I put them in views/shared/DisplayTemplates. However after I move them into an area, looks like ASP.NET MVC won't look inside Area to find the templates. How to reference the DisplayTemplates defined in an Area from main project? Is that a good practise?
View 1 Replies