如何显示“”在ASP.NET的文本框中 [英] How to display "" in a text box in ASP.NET

查看:67
本文介绍了如何显示“”在ASP.NET的文本框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在默认情况下在文本框中显示。



我尝试了什么:



i尝试了这个txtabc.Text =;它显示错误。



我在谷歌检查,我找不到任何解决方案。请协助。



提前致谢

I want to display "" in a textbox by default.

What I have tried:

i tried this txtabc.Text = """"; it is showing error.

i checked in google and i don't find any solutions. please assist.

Thanks in advance

推荐答案

试试这个



try this

txtabc.Text = "\"\"";


为了补充(完全有效)解决方案1,让我向您解释发生了什么。



由于字符串是用双引号分隔的,如果你想在字符串中使用双引号,你有两种方法可以做到这一点:



1-通过转义要放入字符串的双引号(如解决方案1);转义字符是反斜杠( \ )。



2-将每个双引号加倍字符串,但是你必须使用字符串文字。因此,适应您的问题:

To complement the (perfectly valid) solution 1, let me explain you what is going on.

Since the strings are delimited by double quotes, if you want a double quote in the string you have two ways to do that:

1- By escaping the double quotes you want to put in the string (like in solution 1); escape character is backslash (\).

2- By doubling each double-quote you want in the string, but then you have to use a string literal. Thus, adapted to your question:
txtabc.Text = @"""""";



希望这会有所帮助。


Hope this helps.


这篇关于如何显示“”在ASP.NET的文本框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆