ASP.Net, VB: Clearing fields on the webpage

larchiv

New Member
I am developing a website using ASP.Net and VB.On one of the pages, there are certain fields (\[code\]TextBox\[/code\]es and a \[code\]DropDownList\[/code\]).User is supposed to fill out those fields and click 'Submit' button. Also, there is a button 'Clear Values', which if clicked by user should clear the fields on the webpage.The code I have written for clearing the fields was:\[code\]txtBox1.Text = String.Empty\[/code\]for all the \[code\]TextBox\[/code\]es. But, that didn't work, as I have used few validators like \[code\]RequiredFieldValidator\[/code\], \[code\]RangeValidator\[/code\], \[code\]RegularExpressionValidator\[/code\] etc. to validate the fields. So, when the user fills out few fields and then clicks on 'Clear Values' button in order to clear all the fields, then the fields don't get cleared. Insted of that the validations work and the error messages appear as per those validations.I also tried the following code to clear all the fields:\[code\] Response.Redirect("UserData.aspx");\[/code\](where 'UserData.aspx' is name of that webpage only). But, still it gives the same validation error messages.How to tackle this?
 
Back
Top