0

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..

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by AngelicOne
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.