private void ClearControls()
{
foreach (Control container in Parent.Controls)
{
foreach (Control ctrl in container.Controls)
{
if (ctrl is TextBox)
{
((TextBox)ctrl).Text = string.Empty;
}
if (ctrl is CheckBoxList)
{
((CheckBoxList)ctrl).ClearSelection();
}
if (ctrl is RadioButton)
{
((RadioButton)ctrl).Checked = false;
}
}
}
}
{
foreach (Control container in Parent.Controls)
{
foreach (Control ctrl in container.Controls)
{
if (ctrl is TextBox)
{
((TextBox)ctrl).Text = string.Empty;
}
if (ctrl is CheckBoxList)
{
((CheckBoxList)ctrl).ClearSelection();
}
if (ctrl is RadioButton)
{
((RadioButton)ctrl).Checked = false;
}
}
}
}
No comments:
Post a Comment