954,593 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Masterpage problem

I have a masterpage and a default page in a project in VS2010. I am trying to import a javascript file.

If I import the .js file the project compiles and loads but the whole browser screen is blank. If I comment out the javascript import line the page displays correctly.

Below is the two versions of the 'view source' of the page...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>

</title>
    <script type="text/javascript" src="Include/jquery-1.5.1.min.js"/>
    
</head>
<body >
    <form name="aspnetForm" method="post" action="Default.aspx" id="aspnetForm">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTY1NDU2MTA1MmRkGAEJI5+bs1wRmkRMJFsLRxPPhT7Z7NvrME9cYWjxI7s=" />
</div>

    <div>
        
new test

    </div>
    </form>
</body>
</html>


The code above results in a blank web page. Whereare...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>

</title>
    <!--<script type="text/javascript" src="Include/jquery-1.5.1.min.js"/>-->
    
</head>
<body >
    <form name="aspnetForm" method="post" action="Default.aspx" id="aspnetForm">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTY1NDU2MTA1MmRkGAEJI5+bs1wRmkRMJFsLRxPPhT7Z7NvrME9cYWjxI7s=" />
</div>

    <div>
        
new test

    </div>
    </form>
</body>
</html>


This code displays correctly with the words 'new test' at the top of the screen as expected.

The only difference is the the script import line is commented out is the secod block of code.

This is a bare bones test with just the masterpage and a content page. there is no other code or markup than the script import and the test words in the content page.

It does not matter what javascript file is imported the result is the same.

There is one other strange bit. this is a project that was upgraded from VS 2008 and there is another masterpage in the project that has multiple javascript imports and all work correctly. The problem seems to be with the newly created masterpages in VS 2010.

I haven't tried copying the old (vs2008) masterpage and modifying it but this is not the point. I need to be able to create masterpages within VS2010.

Does anyone have any ideas?

Regrds

Ray

rgudgeon
Newbie Poster
3 posts since Jan 2010
Reputation Points: 10
Solved Threads: 0
 

That maybe happens because page and master are not in the same folder. To solve this case register script file on page load.

jugosoft
Junior Poster in Training
80 posts since Jul 2010
Reputation Points: 35
Solved Threads: 12
 

tag. /> is not enough.

hericles
Practically a Posting Shark
823 posts since Nov 2007
Reputation Points: 136
Solved Threads: 168
 
tag. /> is not enough.

Hericles is correct. Adding the closing tag correctly fixed the problem - Thanks

rgudgeon
Newbie Poster
3 posts since Jan 2010
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: