drupal stats

Panel

Clear all TextBox value from a Panel in ASP.NET

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

 

public partial class _Default : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

        ClearTextBoxes(Panel1);

    }

 

    protected void ClearTextBoxes(Control control)

    {

        foreach (Control c in control.Controls)

        {

            if (c is TextBox)

                ((TextBox)c).Text = "";

            if (c is CheckBox)

                ((CheckBox)c).Checked = false;

        }

    }

}