How to specify all controls on the specified page over the ASP.NET
Order: The purpose of writing it is that this code will help some friends!
#Region Clear all control content on the specified page, public static void clearllcontent ()
///
/// Clear all the control content on the specified page, including TextBox, Checkbox, CheckBoxList, Radiobutton, RadiobuttonList. But unclear
// / Dally, in addition to ListBox, DropdownList, because such control values can be used for current pages, generally these controls are dictionary data.
/// Author: Kevin
/// Date: 2004-12-02
/// summary>
/// Specified page param>
Public static void clearllcontent (System.Web.ui.Control Page)
{
Int nPageControls = page.controls.count;
For (int i = 0; i { Foreach (System.Web.ui.Control Control in page.controls [i] .controls) { IF (Control.hasControls ()) { CLEARALLTEXT (Control); } Else { IF (Control Is Textbox) Control as textbox .Text = ""; IF (Control Is Checkbox) Control as checkbox .Checked = false; IF (Control Is RadiobuttonList) Control as radiobuttonlist .selectedIndex = -1; IF (Control Is Radiobutton) Control as radiobutton .Checked = false; IF (Control Is CheckboxList) { Foreach (ListItem Item in (Control as CheckBoxList) .Items { Item.selected = false; } } } // if..else } // foreach } // for } #ndregion