Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

Hey guys,

 

I have to say ASP.NET v2 is great, fantastic new controls, vs2005 is way better than 2003 etc...

 

But there are issues...

 

1. Some controls will still produce code not compatible with XHTM and though validation will fail. Anyway that's not the point of the this thread.

 

Here is my problem.

 

Master pages, yeap great new feature.

 

But how on earth are you supposed to refence your files.

 

say images, scripts etc.

 

Example

 

you have the following folder structure:

Root+
       mymaster.master
       images+
                  img.gif
       pages+
                 page1.aspx
                 english+
                            page2.aspx
       Scripts+
                functions.js

 

if you place an image like:

 

<img src="/images/img.gif" />

 

in the master page, on page1 and page2 that have the mymaster.master as master the reference to the image will be incorrect.

 

Ok ok say you use asp controls for this. <asp:image> etc.. yeah that works....

 

but what happens when its other stuff like an external javascript file.

 

i put the script inside <head>

 

<script type="text/javascript" language="javascript" src="Scripts/functions.js">

</script>

 

page1 and page2 are trying to find the script on /pages/Scripts and /pages/English/scripts respectively, when it is on /Scripts.

 

 

also what about in-line styles ?

 

<div style="background-image:url(Images/img.gif)"></div>

 

 

Is there any solution?

 

am i missing something ?

Edited by otherside
Posted
If you're using standard non server-side html elements, they will function exactly the same way HTML functions. It doesn't matter where the master page is. You're not calling the master page directly; you're calling the page directly. Therefore, you link to resources in regard to where your page (.aspx) is located, not where the master page, or even user control is located.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...