Clear textbox Question

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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?
 
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.
 
Thx Ken
Ken Dopierala Jr. said:
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.
 
Back
Top