Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Is there any other methods to clear the fields since i have many textboxes in my form.

Is there any method as form.submit() in asp.net or form.clear().

Posted

How about something like this;

 

Dim ctrl As Control

For Each ctrl In ctrlParent.Controls

If TypeOf ctrl Is TextBox Then

ctrl.Text = ""

End If

Next

  • Moderators
Posted

You can place a Reset button on the form BUT the problem with that is if you change a textbox's value during postback the reset will consider that new value as the default value. ie...

 

First time you load a page....

text1.Text = ""

 

On postback you cahnge the value because of some condition on the server...

text1.Text = "Hello"

 

Clicking the Reset button now will set text1's value to "Hello"

 

Long story short, use tate's method above.

Visit...Bassic Software

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...