一次清除所有文本 [英] Clearing All Text at Once

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

问题描述

假设我在页面中有10个文本框,在提交后我已经清除了所有文本框中写的文字。



现在我正在这样做

textbox1.text =

textbox2.text =

textbox3.text =

textbox4.text =

textbox5.text =

textbox6.text =

textbox7.text =

textbox8.text =

textbox9.text =

textbox10.text =



任何建议,所以我只写一次,所有文本框中的文字都被清除。

和类似的任何控制

例如面板,如果10面板在那里,我必须只显示一个,并在页面中保持不可见。

所以写一次并应用于所有这些。



等待答案........

suppose I have 10 Textbox in page and after submit i have clear the text written in the all textboxes.

right now i am doing like this
textbox1.text=""
textbox2.text=""
textbox3.text=""
textbox4.text=""
textbox5.text=""
textbox6.text=""
textbox7.text=""
textbox8.text=""
textbox9.text=""
textbox10.text=""

any suggestion ,so i write only once and text in all of the text-boxes get cleared.
and similarly for any control
e.g for panel, if 10 panel are there and i have to make visible only one , and remaining not visible in page.
so write once and applied to all of them .

Waiting For Answer........

推荐答案

好吧,



如果名称就像TextBox1,TextBox2,TextBox3 ..然后你就可以简单地从i = 1到i = n运行循环。另外,还有其他方法,请检查

一篇好的CP文章,



如何在C#.NET中单击清除多个TextBox值 [< a href =http://www.codeproject.com/Tips/255136/How-to-Clear-all-the-TextBox-value-in-Single-Clicktarget =_ blanktitle =New Window> ^ ]



和其他一些来源,



http://stackoverflow.com/questions/4811229/how-to-clear - 所有文本框中的文本 [ ^ ]



http://stackoverflow.com/questions/6783509/clear-the -text-in-multiple-textboxs-at-once [ ^ ]



希望有所帮助

Milind
Well,

If the name is like TextBox1, TextBox2, TextBox3.., then you can simply run loop from i=1 to i=n. Else, there is other ways there,check
One good CP article at,

How to clear a Multiple TextBox values in a single click in C# .NET[^]

And some other sources,

http://stackoverflow.com/questions/4811229/how-to-clear-the-text-of-all-textboxes-in-the-form[^]

http://stackoverflow.com/questions/6783509/clear-the-text-in-multiple-textboxs-at-once[^]

Hope that helps
Milind


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

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