I have this code

private void ResetFormValues(Control parent)
    {
        foreach (Control c in parent.Controls)
        {
            if (c.Controls.Count > 0)
            {
                ResetFormValues(c);
            }
            else
            {
                switch (c.GetType().ToString())
                {
                    case "System.Web.UI.WebControls.TextBox":
                        ((TextBox)c).Text = "";
                        birthdate.Text = "mm/dd/yyyy";
                        break;
                    case "System.Web.UI.WebControls.CheckBoxList":
                        CheckBoxList check = (CheckBoxList)c;
                        for (int i = 0; i < check.Items.Count; i++)
                        {
                            check.Items[i].Selected = false;
                        }
                        break;
                    case "System.Web.UI.WebControls.RadioButton":
                        ((RadioButton)c).Checked = false;
                        break;
                }
            }
        }

Radiobutton and checkboxlist doesn't work..

one question...how many textboxes, checkbox and radio buttons u have on the page...?

35 textbox, 5 radiobuttonlist, and one checkboxlist with 16items.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.