All TextBox or DropDownList or Checkbox are all must be in any Container (Panel,etc..)
private void button1_Click(object sender, EventArgs e)
{
foreach (Control ctrl in pnl.Controls
{
if (ctrl.GetType() ==
typeof(CheckBox))
((CheckBox)ctrl).Checked = true;
if (ctrl.GetType() ==
typeof(Text Box))
((Text Box)ctrl).Text = string.Empty;
if (ctrl.GetType() == typeof(DropDownList))
((DropDownList Box)ctrl).SelectedValue = “0”;
}
}
No comments:
Post a Comment