How to clear a TextBox value in a single click in C# .NET

protected void Button2_Click(object sender, EventArgs e)
{
    ClearInputs(Page.Controls);
}
void ClearInputs(ControlCollection ctrls)
{
    foreach (Control ctrl in ctrls)
    {
        if (ctrl is TextBox)
            ((TextBox)ctrl).Text = string.Empty;
        ClearInputs(ctrl.Controls);
    }
}
posted @ 2011-09-20 14:00  亿典通柄棋  阅读(232)  评论(0编辑  收藏  举报