473,581 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Clear all textbox data

Hi,

I am using asp.net 2 and i want to blank all textbox data of one form with
(for each control) and i write following coding in button control, but it
did not work.
Dim ctl As Control

For Each ctl In Me.Controls

If TypeOf ctl Is TextBox Then

CType(ctl, TextBox).Text = ""

End If

Next

if anyone have answer

thanks

Danial
Jun 21 '06 #1
1 1691
The controls are nested. Write the id's of the controls you do find
into a label and you will see what I mean. They might be inside a form
or contentplacehol der. Mine are in a contentplacehol der called
"MainConten t".

For Each ctl In Me.Form.Control s
If ctl.ID = "MainConten t" Then 'or where-ever your controls
are
content = ctl
End If
Next

For Each ctl In content.Control s
If ctl.GetType() Is GetType(TextBox ) Then
' do your thing here
End If
Next

Jun 21 '06 #2

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

Similar topics

7
2952
by: André Minhorst | last post by:
Hi, some time ago Stephen Lebans advised me to 'clear' the RTF2-Control to prevent some problems with it. Unfortunately I did not find a way to clear this control before inserting the RTFText of the next recordset in a report. Does anyone know how to clear this control or how to clear ActiveX-Controls in general? The RTF2-Control does...
10
11104
by: cppdev | last post by:
Hi All! I want to clear the string contents from sensitive information such as passwords, and etc. It's always a case that password will appear as string at some point or another. And i feel uneasy leaving it hanging in memory indefinitely (especially in case when string is Interned). So at leats for the case when string is not...
5
21049
by: nx-2000 | last post by:
I've got a very large C# forms app and now that its being used in bigger environments we're getting a steady stream of "why does it do this?" problems. The most nagging of which right now is that when a MessageBox.Show() is displayed, if the user hits enter or esc, those keys get passed back to the form. From searching online, this is...
9
12885
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 = FindControl("YourFormID"); foreach(Control ctrl in frm.Controls)
3
1594
by: Ricardo Corsi P. Cesar | last post by:
I have many textbox in my webform, but i want clear all of them with on single step. Someone have the code ? Thks
3
6153
by: jw56578 | last post by:
When a page does a post back and there is data in a textbox, that textbox will get automatically repopulated with that data due to the posting of the form. Disabling viewstate has no affected on textbox controls, so how do you make it so that the text box value is cleared out on postback?
2
1615
by: Tom | last post by:
I have a textbox on my web form were users can enter in 1 name or many names. The form then validates the name against the database. If the name is valid its then saved into a varaible to be used at a later time. The issue I'm having is as follows: the user enters in 2 names John, Greg clicks my valid button they're both valid so both...
6
8346
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.
1
1794
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 the values entered in al the textboxes Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load If...
0
7862
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7789
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8144
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8301
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
5361
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3803
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1400
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1132
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.