469,917 Members | 1,474 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,917 developers. It's quick & easy.

Clear textbox Question

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

Server side you can just do:

TextBox1.Text = ""

Client side you can use javascript:

document.getElementByID('TextBox1').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*********@discussions.microsoft.com> wrote in message
news:62**********************************@microsof t.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.EventArgs)
txtusername.Text = ""
txtpassword.Text = ""
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.getElementByID('TextBox1').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*********@discussions.microsoft.com> wrote in message
news:62**********************************@microsof t.com...
Whats the best way to clear textboxes?
Any ideas?


Nov 18 '05 #3
Hi,

Your Clear button has a CausesValidation 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"
CausesValidation="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*********@discussions.microsoft.com> wrote in message
news:1B**********************************@microsof t.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.EventArgs)
txtusername.Text = ""
txtpassword.Text = ""
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.getElementByID('TextBox1').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*********@discussions.microsoft.com> wrote in message
news:62**********************************@microsof t.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**************@TK2MSFTNGP10.phx.gbl...
Hi,

Your Clear button has a CausesValidation 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"
CausesValidation="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*********@discussions.microsoft.com> wrote in message
news:1B**********************************@microsof t.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.EventArgs)
txtusername.Text = ""
txtpassword.Text = ""
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.getElementByID('TextBox1').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*********@discussions.microsoft.com> wrote in message news:62**********************************@microsof t.com...
> Whats the best way to clear textboxes?
> Any ideas?
>
>


Nov 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by nx-2000 | last post: by
9 posts views Thread by Peter Afonin | last post: by
3 posts views Thread by Ricardo Corsi P. Cesar | last post: by
2 posts views Thread by Tom | last post: by
6 posts views Thread by RP | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.