问题
The issue I am having is that when I create a multiline textbox, it prepends (carriage return line feed) characters.
I am using .NET 4.5. I created an empty project with just a multiline textbox:
<asp:TextBox ID="txtTest" runat="server" TextMode="MultiLine" Rows="5" Columns="50"></asp:TextBox>
In firefox and chrome it renders as:
<textarea name="txtTest" rows="5" cols="50" id="txtTest"> </textarea>
In IE, it is fine.
Thank you in advance.
回答1:
this is fixed in .NET 4.5 RTM version. Are you using 4. RC? Connect issue fixed in RTM
回答2:
Like jmoreno suggested, changing
controlRenderingCompatibilityVersion=4.0
to
controlRenderingCompatibilityVersion=4.5
in web.config
helped me.
回答3:
The initial leading newline (LF or CRLF) of a textarea is ignored.
IE 8 and other older browsers (e.g. Firefox 3) remove the leading newline after parsing character entities.
However newer browsers removing the leading newline before parsing character entities, which then get interpreted as part of the default value of the textarea.
I don't know why .NET would generate those character entities.
来源:https://stackoverflow.com/questions/12827198/extra-characters-added-to-multiline-textbox