I am using Visual Studio 2010 for an MVC website project. I have an big problem and dont know hot to solve it. When i am looking to the output of html in firebug indents in my aspx and ascx files are outputed as space in same places. I think its about line ending of files but i am not sure how to fix them. I am adding some pictures about problem.
When i am adding a breakpoint it also add red background to spaces (this is problem) I try to delete spaces after hit ctrl+k d same problem happen.
If i delete all indents make page 1 line without spaces output is fine but it not a solution.
ASPX/ASCX engine emits literal content within markup as is i.e if your file has spaces or tabs for indentation then they will be output as is. You can use Tools->Options for keeping tabs (instead of space) for indents - you can change for all languages or say only for HTML. VS 2010 has a great extension Productivity Power Tools that will (apart from other things) warn you if your file has tabs & space mix and allows you to choose either tabs or spaces.
Now as a better solution, you can use HttpModule to remove whitespace from your response - see http://madskristensen.net/post/A-whitespace-removal-HTTP-module-for-ASPNET-20.aspx
Related
I created a Powerbuilder app that uses picture buttons. Some icons have names with spaces in them ('icon 1.png'). Now I created a resource file (.pbr). Rebuild goes thrue without problems, however when I ran the app, the picture buttons with icons that have spaces in the title show a white image. It works fine for buttons without spaces ('icon2.png').
Is there a way to make a valid .pbr with spaces? I tryed editing icon paths with ",',~b but I get errors during rebuild.
Yes, it is possible to use spaces in the icon file names. I am already using in Powerbuilder 11.5. What version do you use?
This is really weird. I have an ASP project. I wanted to copy text from an email into the ASPX page (designer view). So, I opened the email, copied the text (CTRL-C) and pasted it into the page. It looked nice, but looking at the source I saw that it flooded the page with MS Word style CSS. So, I undid it. I right-clicked the page, tried Paste, and got the same result (expected). Undid, then tried "Paste Special". I was pleasantly surprised when I saw several choices, including something like, Paste as plain text, but keep line feeds. I used that and it worked perfectly. I was happy!
I get another email and go to do the same thing. I open the email, select the text, Copy (CTRL-C) and go to Visual Studio to paste. Only now, Paste Special is gone! I have Paste, which throws in all of the MS Word CSS again and "Paste Alternate" which rips out all of the line feeds and formatting. There is no more Paste Special!
What the heck happened in the hour between the two emails to make Visual Studio change it's context menu and replace "Paste Special" with the useless "Paste Alternate"? How do I get Paste Special back??
I'm really stuck. I'm working on an integration project where I'm creating a html fragment using ASP.NET. This fragment will be included as part of another site. The html fragment is created using a simple ASP.NET page with a minimal code behind file.
Te site that will include this html fragment is running PHP. The developer there is complaining that my code is sending the byte order mark as part of the html fragment and this is making his life difficult.
I'm using Visual Studio 2010 for development. I've saved the relevant aspx and aspx.cs files as UTF-8 without signature. However, this doesn't seem to have made a difference and now I'm pretty much out of ideas. The rest of the site is set to use UTF-8 as standard (defined in web.config).
Where should I be looking to alter the BOM behaviour for my aspx file?
If you save the file in Visual Studio I believe it will keep adding the BOM. You need to use a different editor to remove the marker such as NotePad++.
Actually in the advanced save as dialog in Visual Studio there is also an option to save UTF-8 without signature. Have you tried this?
It's confirmed in this question.
You can also use plain old NotePad to save with a different encoding.
Save As...Encoding DropDown.
When I display an html file that was created in MS Word, it doesn't render correctly in the ASP Literal control. It seems to have trouble showing tabs, dashes, bullets, etc. Is there something I can do to make this work?
Some characters from MSWord will never appear correct: tabs, bullets, dashes. You could use XL instead of Word and create a macro that changes the bullets to • or dashes to −. I dont think tabs have an html equivilent.
Others characters (international) can only be shown if both your ascx and aspx are both UTF-8 encoded.
I'm using Response.WriteFile("mymenu.aspx") to write a plain text file out to an area in a MasterPage. Unfortunately it's also printing out an unknown character represented by the square character. The contents of the menu file are as followings:
<ul>
<li>Accounts</li>
</ul>
The square character is what is causing my menu to display incorrectly, pushing it down about 20 pixels. I tested putting just the HTML in the master page instead of including the file and it works fine which mean it must be down to the Response.WriteFile function. I don't suppose anyone else has encountered this problem?
EDIT: I tried the following as well, just to really make sure I wasn't doing anything stupid and that the file didn't contain anything dodgy.
<%
Dim tw As New System.IO.StreamReader(Server.MapPath("menu.aspx"))
For Each s As String In tw.ReadToEnd
Response.Write(s)
Next
%>
It worked. But that still doesn't explain Response.WriteFile behaviour.
Have a look at your text file in an editor that will show all characters including carriage returns, line feeds etc. (Notepad++ is my choice). File may have an unusual eof marker or other encoding issue from the software that created the file.
This sounds like a character encoding issue. Is this file in the same encoding as the page your using it from?
Edit
Open the file up in a hex editor make sure there are no weird characters in there.
I tested your code and it rendered correctly for me.
I have seen ASP.NET alter incoming XML strings in WebMethods before. Save the text to a file on disk before you Response.Write it to compare. Check your CSS for your LI style.