Click here to Skip to main content
15,909,827 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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........
Posted
Updated 24-Jan-13 23:53pm
v2

1 solution

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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900