Jump to content
Xtreme .Net Talk

Recommended Posts

  • Leaders
Posted

Hi,

I am using the ASPNETPortal from the ASP.NET Starter Kits as the starting point for a site I'm building. This project makes use of a css style sheet so all the aspx files have the following line in the HTML view of the page inside the <head> </head> tags:

<link rel="stylesheet" href='<%= Global.GetApplicationPath(Request) [b]&[/b] "/ASPNETPortal.css" %>' type="text/css">

 

For some reason when you change anything on the page in design view the IDE automatically changes it to this:

<link rel="stylesheet" href='<%= Global.GetApplicationPath(Request) [b]&[/b] "/ASPNETPortal.css" %>' type="text/css">

 

Then when you run the project it errors on that line. Now I know I can simply change it to this:

<link href='/PortalVBVS/ASPNETPortal.css' type="text/css" rel="stylesheet">

 

The point being that it becomes less portable doing it this way. I'm just wondering if anyone knows how I can get the IDE to stop changing this thing on me all the time.

 

Thanks,

John

"These Patriot playoff wins are like Ray Charles songs, Nantucket sunsets, and hot fudge sundaes. Each one is better than the last." - Dan Shaughnessy
  • Moderators
Posted
There is probably a post-build script in the project file, you can find it and disable or alter it, or you can make the aspx file read-only until such time that you want to change it.
Visit...Bassic Software
  • Leaders
Posted

I don't know what a post-build script is. Where might I find this?

 

Also, this is happening in the IDE, not when I run the project. As soon as I change something on any of the aspx files in design view I can immediately click HTML to view the HTML code and it has already changed.

"These Patriot playoff wins are like Ray Charles songs, Nantucket sunsets, and hot fudge sundaes. Each one is better than the last." - Dan Shaughnessy
  • Leaders
Posted

I changed it to use String.Concat instead of the concatenation operator:

<link href='<%= String.Concat(Global.GetApplicationPath(Request), "/ASPNETPortal.css") %>' type=text/css rel=stylesheet>

All is well now.

 

Thanks,

John

"These Patriot playoff wins are like Ray Charles songs, Nantucket sunsets, and hot fudge sundaes. Each one is better than the last." - Dan Shaughnessy
Posted

Out of curiousity, could you not also have simply inserted a literal control?

 

<head>
 <ASP:Literal ID="litCSSLink" RunAt="server" />
</head>

 

And somewhere else

 

litCSSLink.Text = "<link rel=\"stylesheet\" type=\"text/css\" href=\"" & Global.GetApplicationPath(Request) & "/ASPNETPortal.css" />"

 

Just wondering because I've gotten the impression doing the <%=myVar%> style was not the preferred way of doing things anymore as of .NET. Is it still considered OK in certain situations such as this?

 

Oh, and it occurs to me...why concat at all?

 

<link rel="stylesheet" href='<%= Global.GetApplicationPath(Request) %>/ASPNETPortal.css' type="text/css">

 

Shouldn't this produce the same result?

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...