Hi all. I have 3 textboxes (TextBox1, TextBox2 and TextBox3) and a button. I am tried clearing all the textboxes using foreach loop. I tried using the code below, but while debugging it, the debugger skips the line: "if (c is TextBox)" and so the textboxes
dont get cleared. Am I doing something wrong here?
protected void Button1_Click(object sender, EventArgs e)
{
ClearTextBoxes(this);
}
public void ClearTextBoxes(Control control)
{
foreach (Control c in control.Controls)
{
if (c is TextBox)
{
((TextBox)c).Text = "";
}
}
}
...
Go to the complete details ...