Leaders John Posted April 25, 2005 Leaders Posted April 25, 2005 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 Quote "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 Robby Posted April 25, 2005 Moderators Posted April 25, 2005 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. Quote Visit...Bassic Software
Leaders John Posted April 25, 2005 Author Leaders Posted April 25, 2005 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. Quote "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 John Posted April 26, 2005 Author Leaders Posted April 26, 2005 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 Quote "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 Robby Posted April 27, 2005 Moderators Posted April 27, 2005 cool........ Quote Visit...Bassic Software
fizzled Posted May 4, 2005 Posted May 4, 2005 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? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.