Results 1 to 6 of 6

Thread: Clear the Form control values

  1. #1

    Thread Starter
    Hyperactive Member buddu's Avatar
    Join Date
    Jul 2001
    Location
    India
    Posts
    446

    Clear the Form control values

    hi
    I have created a form with 5 textboxes and Two Buttons like Save and Cancel.

    When i Click the Save Button it refers to the Save routine in Server side like

    <script runat=server>
    Sub SaveClk(................)
    ..........
    ............
    End Sub
    </script>
    now the problem is i need to Clear the all Textbox values after finish my Save Routine. If i have RESET button i can use that. But i need to clear after my save routine finished..

    Any idea?
    prasad

  2. #2
    Addicted Member
    Join Date
    Aug 2000
    Posts
    183
    What I would do is create a function that does all the clearing and then call that after you are done with the Save. You can just call the same routine for the clear button too.

  3. #3

    Thread Starter
    Hyperactive Member buddu's Avatar
    Join Date
    Jul 2001
    Location
    India
    Posts
    446
    Your idea is good but if i have 50 textboxes in my form How will u write the code. Will you write like as follow.?

    textbox1.value=""
    textbox2.value=""
    .....
    ...
    ....
    ...
    textbox50.value=""

    any idea.?
    prasad

  4. #4
    Member
    Join Date
    Dec 2000
    Location
    UK
    Posts
    39
    You could just do a Response.Redirect back to the page, that should clear the values of the textboxes.

  5. #5

    Thread Starter
    Hyperactive Member buddu's Avatar
    Join Date
    Jul 2001
    Location
    India
    Posts
    446
    can't we Use for Each Statement Like VB.?
    prasad

  6. #6
    Hyperactive Member jeba's Avatar
    Join Date
    Feb 2000
    Posts
    265
    Hi buddu!
    You may turn off the View state feature, so that all your controls are cleared automatically like traditional ASP.

    I hope its something like this, and it should be at the page level.
    <% EnableViewstate=false %>
    J£ßä

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width