English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I want to clear all the data entered by user at the time of post back.
Is there any special command to clear all the containts on web form. I am using vb.net as serverside and text/javascript as client side language.

2006-12-13 03:14:21 · 1 answers · asked by dipak 2 in Computers & Internet Programming & Design

1 answers

1) Since you want to clear everything on Page PostBack, then you can write a function (subroutine in VB.NET) to clear the controls manually one by one.
ex:
Private Sub Clear()
TextBox1.Text = ""
DropDownList1.SelectedIndex = -1
.
.
.

End Sub

2) In general there is no special way to do it but If you disable ViewState for the controls one by one, the controls will stop storing their state in ViewState and will clear by themselves. However this might introduce unexpected bugs in the later stages of development.

3) Note: You can add an input of type "reset" to clear everything on the client side, however this will clear the results without posting the page back to the server i.e. before you can get to read the entered values by the user


4) Another way to clear those on the client is to use Javascript to clear them one by one. However as in 3) the page will not post back to the server

Best Regards

2006-12-13 04:20:48 · answer #1 · answered by Smutty 3 · 1 0

fedest.com, questions and answers