Exemple #1
0
    private static void FindControlsRecursive(Control ctrRoot, PropiedadControl propiedadControl)
    {
        foreach (Control c in ctrRoot.Controls)
        {
            if (c.GetType() == typeof(Button))
            {
                if (!c.ID.ToLower().Contains("showpopup"))
                {
                    switch (propiedadControl)
                    {
                    case PropiedadControl.NoVisible:
                        ((Button)c).Visible = false;
                        break;

                    case PropiedadControl.Disabled:
                        ((Button)c).Enabled = false;
                        break;
                    }
                }
            }
            else if (c.HasControls())
            {
                FindControlsRecursive(c, propiedadControl);
            }
        }
    }
Exemple #2
0
    public static void AplicarPropiedadControles(ControlCollection crtlCollection, PropiedadControl propiedadControl)
    {
        foreach (Control c in crtlCollection)
        {
            if (c.GetType() == typeof(Button))
            {
                if (!c.ID.ToLower().Contains("showpopup"))
                {
                    switch (propiedadControl)
                    {
                    case PropiedadControl.NoVisible:
                        ((Button)c).Visible = false;
                        break;

                    case PropiedadControl.Disabled:
                        ((Button)c).Enabled = false;
                        break;
                    }
                }
            }
            else if (c.HasControls())
            {
                FindControlsRecursive(c, propiedadControl);
            }
        }
    }