473,396 Members | 2,087 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How can i do to clear all the textbox using controls?

I have many textbox in my webform, but i want clear all of them with on
single step.

Someone have the code ?

Thks


Nov 18 '05 #1
3 1584

For Each Control in me.controls
if control is textbox then... ctype(control,textbox).text =""
next

Didnt tested it... but should be something like this

Joao Cardoso (MVP dotNET)
================================================== =====
[LusoCoders]- http://groups.yahoo.com/group/lusocoders/
[PontoNetPT]- http://www.programando.net/regras.aspx
jj***@acinet.pt.n.o-s.p-a.m - www.acinet.pt
================================================== =====
Nov 18 '05 #2

This sample code should do what you're looking for:

Sub ClearTextBoxes()
Dim myForm As Control = Page.FindControl("form1")
Dim ctl As Control
For Each ctl In myForm.Controls
If ctl.GetType().ToString().Equals("System.Web.UI.Web Controls.TextBox")
Then
CType(ctl, TextBox).Text = ""
End If
Next ctl
End Sub
Hope this helps,
Chris Moore [MSFT]
--------------------
From: "Ricardo Corsi P. Cesar" <rc****@webcompany.com.br>
Subject: How can i do to clear all the textbox using controls?
Date: Fri, 21 Nov 2003 15:19:09 -0200
Lines: 16
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <eG**************@tk2msftngp13.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: 200-171-96-217.speedyterra.com.br 200.171.96.217
Path: cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTN GP08.phx.gbl!tk2msftngp13.
phx.gblXref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:191914
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

I have many textbox in my webform, but i want clear all of them with on
single step.

Someone have the code ?

Thks




Nov 18 '05 #3
You can use the HTML reset button. It works on the Web
controls also.
-----Original Message-----
I have many textbox in my webform, but i want clear all of them with onsingle step.

Someone have the code ?

Thks


.

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Joe | last post by:
I'm wondering how to loop through controls in VB.NET. I have the code from VB6 ok, but I can't figure out how to do it correctly in .NET. This is an example from my VB6 code that loops through...
6
by: Thonglao Rud | last post by:
I'm trying to clear all textbox on the form. foreach (Control c in this.Controls) { //if (c.GetType() == typeof(TextBox)) if (c is TextBox) { // Found it c.Text = "";...
9
by: Peter Afonin | last post by:
Hello: I need to clear all textboxes on the webform after the data has been submitted. How can I do this in one step? I found a C# code: // get a reference to your form control Control frm...
5
by: Jason Huang | last post by:
Hi, In my C# Windows Form MyForm, it has many TextBoxes, e.g., txtName, txtID, txtAddress, ..., it also has many ComboBoxes, e.g., cboState, cboGender. How do I clear all those controls's Text...
2
by: Duk Lee | last post by:
What is the most elegant way to clear all the text fields on asp.net page? I just don't think that txtShortName.Text = "" txtYearFounded.Text = "" txtCompanyCode.Text = "" txtCity.Text = ""...
1
by: anilkumar1980 | last post by:
Hi All, Here I need help to all of u, I am using ASP.NET 2.0 and Third party Infragistic Controls. I Have included master page in my page (<%@ Page Language="VB"...
6
by: RP | last post by:
I want to clear all the Text Boxes on the Form. Is there any short method to avoid clearing them one by one.
0
by: asumal | last post by:
Hello I am new to ASP.NET. I am using CreateUserWizard control to register & create a user. I am using Membership API. I have a Cancel button on the second step of CreateUserWizard control...
1
by: adarshyam | last post by:
can anybody tel me how to clear values from dynamically created text boxes?? using a clear button.. this is the code used to create dynamic text boxes.. if i press clear button then it must clear all...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.