473,811 Members | 3,264 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Clear textbox Question

Whats the best way to clear textboxes?
Any ideas?
Nov 18 '05 #1
4 1745
Hi,

Server side you can just do:

TextBox1.Text = ""

Client side you can use javascript:

document.getEle mentByID('TextB ox1').value = ""

Is there something more that you are trying to do? Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"Patrick.O. Ige" <Pa*********@di scussions.micro soft.com> wrote in message
news:62******** *************** ***********@mic rosoft.com...
Whats the best way to clear textboxes?
Any ideas?

Nov 18 '05 #2
Well Ken i use the style below as u recommended before but when i use
ASP.NET Validators and later click on Clear button it fires the validating
events which is not suppose to be fired:-

Sub Clear(ByVal sender As Object, ByVal e As System.EventArg s)
txtusername.Tex t = ""
txtpassword.Tex t = ""
End Sub

Anything i'm doing wrong?

"Ken Dopierala Jr." wrote:
Hi,

Server side you can just do:

TextBox1.Text = ""

Client side you can use javascript:

document.getEle mentByID('TextB ox1').value = ""

Is there something more that you are trying to do? Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"Patrick.O. Ige" <Pa*********@di scussions.micro soft.com> wrote in message
news:62******** *************** ***********@mic rosoft.com...
Whats the best way to clear textboxes?
Any ideas?


Nov 18 '05 #3
Hi,

Your Clear button has a CausesValidatio n property. Set this property to
false and it won't force a validation when it posts back:

<asp:Button runat="server" id="btnClear" text="Clear"
CausesValidatio n="False"></asp:Button>

Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"Patrick.O. Ige" <Pa*********@di scussions.micro soft.com> wrote in message
news:1B******** *************** ***********@mic rosoft.com...
Well Ken i use the style below as u recommended before but when i use
ASP.NET Validators and later click on Clear button it fires the validating
events which is not suppose to be fired:-

Sub Clear(ByVal sender As Object, ByVal e As System.EventArg s)
txtusername.Tex t = ""
txtpassword.Tex t = ""
End Sub

Anything i'm doing wrong?

"Ken Dopierala Jr." wrote:
Hi,

Server side you can just do:

TextBox1.Text = ""

Client side you can use javascript:

document.getEle mentByID('TextB ox1').value = ""

Is there something more that you are trying to do? Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"Patrick.O. Ige" <Pa*********@di scussions.micro soft.com> wrote in message
news:62******** *************** ***********@mic rosoft.com...
Whats the best way to clear textboxes?
Any ideas?


Nov 18 '05 #4
Thx Ken
"Ken Dopierala Jr." <kd*********@wi .rr.com> wrote in message
news:#a******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

Your Clear button has a CausesValidatio n property. Set this property to
false and it won't force a validation when it posts back:

<asp:Button runat="server" id="btnClear" text="Clear"
CausesValidatio n="False"></asp:Button>

Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"Patrick.O. Ige" <Pa*********@di scussions.micro soft.com> wrote in message
news:1B******** *************** ***********@mic rosoft.com...
Well Ken i use the style below as u recommended before but when i use
ASP.NET Validators and later click on Clear button it fires the validating events which is not suppose to be fired:-

Sub Clear(ByVal sender As Object, ByVal e As System.EventArg s)
txtusername.Tex t = ""
txtpassword.Tex t = ""
End Sub

Anything i'm doing wrong?

"Ken Dopierala Jr." wrote:
Hi,

Server side you can just do:

TextBox1.Text = ""

Client side you can use javascript:

document.getEle mentByID('TextB ox1').value = ""

Is there something more that you are trying to do? Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"Patrick.O. Ige" <Pa*********@di scussions.micro soft.com> wrote in message news:62******** *************** ***********@mic rosoft.com...
> Whats the best way to clear textboxes?
> Any ideas?
>
>


Nov 18 '05 #5

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

Similar topics

5
21131
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 apparently by design(for whom, I don't know, why its not optional, I _really_ don't know). This...
9
12916
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
1611
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
2
1630
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 names are stored in the variable so my variable looks like John,Greg and both are in the textbox. ...
6
8382
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
1456
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 alongwith Create User button & Previous button. Actually, i have added some more textboxes on the default control for taking user's personal information. The problem is that when i call the below mentioned code all textboxes for user's personal information...
1
1809
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 IsPostBack Then Try If Not TextBox1.Text Is String.Empty Then ...
6
53197
by: aeris | last post by:
Hello, I'm a beginner of using C#. I'm creating a window application, May I know how to clear the default text on textbox when I click directly on the textbox? For example, the txtBox has the words "", so how to make the words all clear when user click on the textbox ? Sorry for disturbing you all, can someone provide me the codes please? Thanks,
4
3038
by: aeris | last post by:
Hello! I'm using C# to doing my window application. May I ask, how to write text on textbox after the default text is clear? I have setted the default text in textbox, when a user click on it, the default text is automatically clear. I did that by using "Click" event. But then, how to enable the user write text in the textbox? private void textBox_TextChanged(object sender, EventArgs e) { textBox.Text =...
0
9727
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10386
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10398
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7669
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6889
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4339
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
2
3865
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3017
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.