Although nothing new, I like this one and have done similar things in the past. +4. My issue with this is that if there are that many text controls on a page that would warrant this approach to clear them all, then the page is perhaps too large. As well, in my experience, text boxes on a form are usually set to a default state and that default state on a properly designed form would contain values other than string.empty.
mr.Prabhu_R did u check my code before write this comment? Dont do like this hereafter. Check the code in your IDE afterwards post any comments ok. Your brain doesnt have any debugging tools. got it. remove that line and check if it works or not then u can post a comment got it.
What about the situation where we need to clear some of the textbox and not all.I know your solution is specific for situation where all the text boxes need to be cleared. But i am looking for a situation in which i can clear some of the text box. Can we explicitly build a control collection in which we include only text boxes that we need to clear.
Check it out here: Click Here for the code. Look at the second set of codes. It will clear all textbox controls except those with a specified name. Its vb but its easy to convert. I think this is what you were wanting?