Clearing All Textbox Programatically in ASP.NET Web Form

by Nathan 15. July 2009 11:04

There are multiple ways of doing this ie using JavaScript, but this is the server side solution.

You can adapt this method for several other solutions:

        foreach (Control c in this.Page.Controls)
        {                        
            if(c.GetType().FullName.Equals("System.Web.UI.HtmlControls.HtmlForm")) {
                foreach (Control cForm in c.Controls)
                {                        
                    if(cForm.GetType().Equals(typeof(TextBox))) {   
                        ((TextBox)(cForm)).Text = "";
                    }
                }
            }
        }

Tags:

ASP.NET

Comments

8/11/2009 5:58:10 AM #

cash loans

Hey very nice blog!! Man .. Beautiful .. Amazing .. I will bookmark your blog and take the feeds also...

cash loans United States

8/15/2009 2:34:23 AM #

Zeno Pilot Oversized Power

Hmm strange this post is totaly irrelevant to the search query I entered in google but it was listed on the first page.

Zeno Pilot Oversized Power United States

8/17/2009 1:00:06 AM #

Joe Rodeo Master Collection

Hmm strange this post is totaly irrelevant to the search query I entered in google but it was listed on the first page.

Joe Rodeo Master Collection United States

8/18/2009 10:26:25 PM #

Hublot Classic Elegant Mens

Would you like to post a guest post on my blog?

Hublot Classic Elegant Mens United States

8/27/2009 11:27:51 AM #

Baume Mercier Classima

I don't like your template but your posts are quite good so I will check back!

Baume Mercier Classima United States

8/28/2009 7:14:34 AM #

bad credit loans

Your blog is so informative � keep up the good work!!!!

bad credit loans United States

11/29/2009 7:11:57 AM #

games

Hey admin, amazing post. please continue this awesome work..

games

12/17/2009 2:50:25 PM #

nigeria holidays

Hi. I treasured to drop you a quick note to express my thanks. I've been watching your blog for a month or so and have plucked up a heap of good information as well as enjoyed the way you've structured your site. I am attempting to run my own blog however I think its too general and I would like to focus more on smaller topics.

nigeria holidays United States

12/25/2009 2:56:16 AM #

Martha

Howdy, I tracked down this site by accident when I was looking on Google then I came upon your web site. I have to say your site is interesting I love your theme! At this moment I don’t possess the time at the moment to fully look through your sitebut I bookmarked it. I will come back in a day or two. Thanks for a great site.

Martha United States

12/25/2009 9:21:52 AM #

Mary

It’s good to see you make postings on this topic, I need to book mark this website. Just keep up the good work.

Mary United States

12/25/2009 8:49:15 PM #

Victoria

Most helpful site and information

Victoria United States

12/27/2009 12:13:56 PM #

Sam

You got some great ideas there. I did a search on the issue and learnt most peoples will agree with your blog.

Sam United States

1/2/2010 7:50:59 PM #

Juan

You had some nice points here. I done a research on the topic and got most peoples will agree with your blog.

Juan United States

1/12/2010 3:50:07 PM #

tetris online

Hey, good morning. Totally Great post. You have gained a new fan. Pls keep up the good work and I look forward to more of your awesome articles. Sincerely, Zena!

tetris online

1/12/2010 4:56:42 PM #

tetris online

Hello admin, good morning. Brilliant work. You have gained a new fan. Please keep it up and I look forward to more of your gorgeous blog posts. Take care, Calvin.

tetris online

1/25/2010 12:49:08 AM #

cheap web hosting

Can you please provide more details on this subject?? BTW your web log is nice. Cheers!

cheap web hosting

1/27/2010 8:16:29 PM #

Kaleb

Aw, this was a really quality post. In theory I'd like to write like this too - taking time and real effort to make a good article... but what can I say... I procrastinate alot and never seem to get something done.

Kaleb United States

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Powered by BlogEngine.NET 1.6.0.0
Theme by Mads Kristensen