Automatically Clear Html Controls



        protected void AllTextBoxClear(Control c)
        {
            TextBox t = c as TextBox;
            if (t != null)
            {
                string hi = t.Text = "";
            }

            foreach (Control child in c.Controls)
                AllTextBoxClear(child);
        }

        protected void AllCheckBoxClear(Control c)
        {
            CheckBox t = c as CheckBox;
            if (t != null)
            {
                t.Checked = false;
            }

            foreach (Control child in c.Controls)
                AllCheckBoxClear(child);

        }

Comments

Popular posts from this blog

Insecure cookie setting: missing Secure flag

Maximum Stored Procedure Function Trigger or View Nesting Level Exceeded (limit 32) in SQL Server

Display Line Chart Using Chart.js MVC C#