ResolveUrl and JavaScript Intellisense in Visual Studio

26 October 2008 16:09 by 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>
<% } %>



1302 times displayed

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

ASP.NET | JavaScript | Tips & Tricks

Installing Fedora 9 in Virtual PC 2007

30 June 2008 22:00 by mustafaozcan

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Programs | Tips & Tricks

How to extend the Windows Server 2008 evaluation period

26 June 2008 17:23 by mustafaozcan

How to manually extend the evaluation period
When the initial 60-day evaluation period nears its end, you can run the Slmgr.vbs script to reset the evaluation period. To do this, follow these steps:
1.Click Start, and then click Command Prompt.
2.Type slmgr.vbs -dli, and then press ENTER to check the current status of your evaluation period.
3.To reset the evaluation period, type slmgr.vbs –rearm, and then press ENTER.
4.Restart the computer.
This resets the evaluation period to 60 days.

How to automate the extension of the evaluation period
You may want to set up a process that automatically resets the evaluation period every 60 days. One way to automate this process is by using the Task Scheduler. You can configure the Task Scheduler to run the Slmgr.vbs script and to restart the server at a particular time. To do this, follow these steps:
1.Click Start, point to Administrative Tools, and then click Task Scheduler.
2.Copy the following sample task to the server, and then save it as an .xml file. For example, you can save the file as Extend.xml. 

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2007-09-17T14:26:04.433</Date>
    <Author>Microsoft Corporation</Author>
  </RegistrationInfo>
  <Triggers>
    <TimeTrigger id="18c4a453-d7aa-4647-916b-af0c3ea16a6b">
      <Repetition>
        <Interval>P31D</Interval>
        <StopAtDurationEnd>false</StopAtDurationEnd>
      </Repetition>
      <StartBoundary>2007-10-05T02:23:24</StartBoundary>
      <EndBoundary>2008-09-17T14:23:24.777</EndBoundary>
      <Enabled>true</Enabled>
    </TimeTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>domain\alias</UserId>
      <LogonType>Password</LogonType>
      <RunLevel>HighestAvailable</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <IdleSettings>
      <Duration>PT10M</Duration>
      <WaitTimeout>PT1H</WaitTimeout>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>
    <StartWhenAvailable>false</StartWhenAvailable>
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <WakeToRun>true</WakeToRun>
    <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
    <DeleteExpiredTaskAfter>PT0S</DeleteExpiredTaskAfter>
    <Priority>7</Priority>
    <RestartOnFailure>
      <Interval>PT1M</Interval>
      <Count>3</Count>
    </RestartOnFailure>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>C:\Windows\System32\slmgr.vbs</Command>
      <Arguments>-rearm</Arguments>
    </Exec>
    <Exec>
      <Command>C:\Windows\System32\shutdown.exe</Command>
      <Arguments>/r</Arguments>
    </Exec>
  </Actions>
</Task>

3.In the sample task, change the value of the following “UserID” tag to contain your domain and your alias:
<UserId>domain\alias</UserId>
4.In the Task Scheduler, click Import Task on the Action menu.
5.Click the sample task .xml file. For example, click Extend.xml.
6.Click Import.
7.Click the Triggers tab.
8.Click the One Time trigger, and then click Edit.
9.Change the start date of the task to a date just before the end of your current evaluation period.
10.Click OK, and then exit the Task Scheduler.
The Task Scheduler will now run the evaluation reset operation on the date that you specified.



1413 times displayed

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Tips & Tricks

Using Master Pages and ResolveUrl() in ASP.NET

16 June 2008 15:47 by mustafaozcan

MasterPages came with ASP.NET 2.0 and it's very useful. If you are using master pages, JavaScript files, images, links and sub folders in own projects. This article is very useful for you.

For example you insert image in your master page and create an aspx file in subfolder.

In master page : <img src="Images/mustafaozcanblog.png" alt="Mustafa ÖZCAN's Blog" />

Sample.aspx file is in samples folder and it is use master page in root folder. Added images cannot be displayed in rendered sample.aspx page because images folder in root folder but samples.aspx page search it in samples directory.

So you have two ways solution for this problem:

1st Way: You must change this line for added image  : 


<img src="~/Images/mustafaozcanblog.png" alt="Mustafa ÖZCAN's Blog" runat="server"/>


2nd Way: You must change this line for added image :


 <img src='<%=ResolveUrl("~/Images/mustafaozcanblog.png")%>' alt="Mustafa ÖZCAN's Blog" />


You can use 2nd Way to added JavaScript files and other external content in master page file.



2222 times displayed

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

ASP.NET | Tips & Tricks

Powered by BlogEngine.NET 1.4.0.0

About the author

Mustafa OZCAN Mustafa ÖZCAN
Software Developer

E-mail me Send mail

Recent comments

Comment RSS

Calendar

<<  January 2009  >>
MoTuWeThFrSaSu
2930311234
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 2269
   

Online

Online Visitors : 6