private static void MakePageControlsBlank(Control myControl)
{
foreach (Control cntrl in myControl.Controls)
{
switch (cntrl.GetType().ToString())
{
case "System.Web.UI.WebControls.TextBox":
((TextBox)cntrl).Text = "";
break;
case "System.Web.UI.WebControls.CheckBox":
((CheckBox)cntrl).Checked = false;
break;
case "System.Web.UI.WebControls.RadioButton":
((CheckBox)cntrl).Checked = false;
break;
case "System.Web.UI.WebControls.Literal":
((Literal)cntrl).Text = "";
break;
case "System.Web.UI.WebControls.DropDownList":
((DropDownList)cntrl).SelectedIndex = 0;
break;
default:
break;
}
}
}
Make Controls Blank On a Page
This code will change the states of the container control's controls
0 comments:
Post a Comment