×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: ASP
Posted by: Mario Lopes
Added: Nov 22, 2019 12:21 PM
Views: 4140
Tags: no tags
  1. protected void ClearTextBoxes(Control p1)
  2. {
  3.     foreach (Control ctrl in p1.Controls)
  4.     {
  5.         if(ctrl is TextBox)
  6.         {
  7.              TextBox t = ctrl as TextBox;
  8.  
  9.              if(t != null)
  10.              {
  11.                   t.Text = String.Empty;
  12.              }
  13.         }
  14.         else
  15.        {
  16.            if (ctrl.Controls.Count > 0)
  17.            {
  18.                ClearTextBoxes(ctrl);
  19.            }
  20.         }
  21.     }
  22. }
  23.  
  24. //-----------
  25. chamar
  26.  ClearTextBoxes(Page);