.

disable controls recursively

 

private void RecursDisableCtrls(Control ctr)
        {
                    if (ctr.Controls.Count > 0)
                        foreach (Control ee in ctr.Controls)
                        {
                            RecursDisableCtrls(ee);
                        }
                    {
                        if (ctr is WebControl)
                        {
                            if ((ctr as WebControl).ID == "ButtonCancel") //exclude this butt e.g.
                                return;
                            (ctr as WebControl).Enabled = false;
                        }
                    }
        }

 

What's your thoughts on this?

*

Protected by WP Anti Spam