ResolveUrl and JavaScript Intellisense in Visual Studio

 - 26 October 2008 16:09 mustafaozcan

Visual Studio JavaScript intellisense feature is very cool. But if you are adding JavaScript files to Master Pages with ResolveUrl method, you can not use intellisense feature in design time. Also you can use intellisense feature with different way. There is a sample code below.

In Master Page :



<script src="<%=ResolveUrl("~/Js/jquery-1.2.6-intellisense.js")%>"
type="text/javascript"></script>

<asp:Literal ID="ltrJs" runat="server" Visible="false" EnableViewState="false">
<script src="Js/jquery-1.2.6-intellisense.js" type="text/javascript"></script>
</asp:Literal>

First section is require for detect javascript file's url in runtime. Second section is require for intellisense support in design time. Second section can not display in rendered page. Of course you can use intellisense feature in which pages using this master page.

Updated - 03.11.2008 (Thanks to Visual Web Developer Team) The other way:


<script src="<%=ResolveUrl("~/Js/jquery-1.2.6.js")%>"
type="text/javascript"></script>

<% if (false) { %>
<script src="Js/jquery-1.2.6-intellisense.js" type="text/javascript"></script>
<% } %>


Paylaş

Tags: , , ,

ASP.NET | JavaScript | Tips & Tricks

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



About the author

Mustafa OZCAN Mustafa ÖZCAN
Software Developer

E-mail me Send mail

PayPal Donate


Recent comments

Comment RSS

Calendar

<<  July 2010  >>
MoTuWeThFrSaSu
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

View posts in large calendar

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in  anyway.

© Copyright 2008

Added Files

File Hit
jquery-1.2.6-intellisense.js 3744
   

Online : 5