简体   繁体   English

在VB.NET的多行文本框回发期间插入了额外的回车符

[英]Extra Carriage Return inserted during multiline textbox postback in VB.NET

Environment : Visual studio 2013 - Framework 4.0, IE11, Oracle 11g 环境:Visual Studio 2013-Framework 4.0,IE11,Oracle 11g

I have an ASP.NET TextBox with TextMode = TextBoxMode.MultiLine that is getting filled with data from Oracle. 我有一个ASP.NET TextBox,它的TextMode = TextBoxMode.MultiLine正在被来自Oracle的数据填充。 The same data is getting added to a ViewState variable as well, as I need to find a difference between the original database value and multi-line textbox value when a page is posted back upon Save button click. 同样的数据也将添加到ViewState变量中,因为单击“保存”按钮后将页面放回时,我需要找到原始数据库值和多行文本框值之间的差异。

If I am changing the value in the textbox, it should be different. 如果要更改文本框中的值,则该值应该不同。 However, the values are equated to be different even if I am not changing anything in the multi-line textbox while saving it. 但是,即使我在保存时不更改多行文本框中的任何内容,这些值也等同于不同。

The strange part is, this only occurs in IE11. 奇怪的是,这仅发生在IE11中。 Google chrome is fine! 谷歌浏览器很好!

I've tried converting both values to ASCII upon save button click and found that multi-line textbox has extra carriage return (ASCII value - 13) for new line. 我尝试在单击保存按钮时将两个值都转换为ASCII,发现多行文本框对于新行具有额外的回车符(ASCII值-13)。

The string in ViewState converts the new line to ASCII 10, whereas same string in Textbox converts the new line to ASCII 13(Carriage return) and ASCII 10(new line feed). ViewState中的字符串将新行转换为ASCII 10,而Textbox中的相同字符串将新行转换为ASCII 13(回车)和ASCII 10(新换行)。

My solutions to this is to remove the extra 13(carriage return) from textbox while comparing it and saving it. 我对此的解决方案是在比较文本框并将其保存时从文本框中删除多余的13(回车符)。

I just wanted to see if anyone else has ever encountered this problem, is there a .NET fix to it or I am doing something wrong? 我只是想看看是否有人遇到过此问题,是否有.NET修复程序或者我做错了什么? (which I doubt as its working fine in chrome) (我怀疑它在chrome中可以正常工作)

Thank you for your inputs. 感谢您的投入。

网页设计的一般经验法则仍然有用:IE会让您发疯。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM