C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » ASP.NET WebForms »

Clear all text boxes in a page


Posted Date: 28 Oct 2008    Resource Type: Code Snippets    Category: ASP.NET WebForms
Author: Prasanth Kumar S.DMember Level: Gold    
Rating: 1 out of 5Points: 10



Function to clear all text boxes in a page
---------------------------------------
This sample code shows a function to clear all the text boxes in a page.


protected void ClearControl(Control Ctrl)//passing the control
{
foreach (Control eachCtrl in Ctrl.Controls)//loop taking each controls
{
if (eachCtrl.Controls.Count > 0)
ClearControl(eachCtrl);
else if (eachCtrl is TextBox)
((TextBox)eachCtrl).Text = null;
}
}



how to call

ClearControl(this);




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Function to clear all text boxes in a page  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: SQL Helper Class
Previous Resource: Listbox-binding data to a list box
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET WebForms


Post resources and earn money!
 
Related Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use