清除在ASP.NET一个TextBox [英] Clearing a TextBox in ASP.NET

查看:181
本文介绍了清除在ASP.NET一个TextBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有网页,那里是有一些默认值文本框。

我必须清除文本框中的值。我有2个选项

  1。 textbox.text =;
2. textbox.text.remove(0,长度);

在这里,我想知道我应该使用哪一个。这会让在页面性能产生任何影响,因为有很多文本框放置在页面上。

感谢


解决方案

要做到这一点,最好的办法是...

  textbox.text =的String.Empty;


  

还记得字符串类型
  一成不变的!


I have webpage where there is textbox having some default value.

I have to clear the value from text box. I have 2 options

1. textbox.text="";
2. textbox.text.remove(0,length);

Here i would like to know which one should i use. Does it make any impact on page performance because there are many textbox placed in page.

Thanks

解决方案

The best way to do this is..

textbox.text = string.Empty;

Also remember that string type is immutable!

这篇关于清除在ASP.NET一个TextBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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