Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. clear all textboxes in a form

clear all textboxes in a form

Scheduled Pinned Locked Moved ASP.NET
tutorial
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Safna Kasim
    wrote on last edited by
    #1

    How to clear all textboxes in a form

    S A 2 Replies Last reply
    0
    • S Safna Kasim

      How to clear all textboxes in a form

      S Offline
      S Offline
      Safna Kasim
      wrote on last edited by
      #2

      public void clearalltext(Form f) { foreach (Control c in f.Controls) { if (c.GetType().ToString() =="System.Windows.Forms.TextBox") c.Text = ""; } }

      I 1 Reply Last reply
      0
      • S Safna Kasim

        public void clearalltext(Form f) { foreach (Control c in f.Controls) { if (c.GetType().ToString() =="System.Windows.Forms.TextBox") c.Text = ""; } }

        I Offline
        I Offline
        Imran Khan Pathan
        wrote on last edited by
        #3

        foreach (Control cntr in this.Page.Controls) { if (cntr is TextBox) { ((TextBox)cntr).Text = ""; } } Regard Imrankhan

        please don't forget to vote on the post that helped you.

        1 Reply Last reply
        0
        • S Safna Kasim

          How to clear all textboxes in a form

          A Offline
          A Offline
          Abhishek Sur
          wrote on last edited by
          #4

          Place a Reset button on the form using <Input type="Reset" /> Or you can also do : javascript:document.form1.reset(); to clear all data at a time without postback... ;) Form1 indicates the name of the form created. :thumbsup:

          Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


          My Latest Articles-->** Microsoft Bing MAP using Javascript
          CLR objects in SQL Server 2005
          Uncommon C# Keywords
          /xml>

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups