Пример #1
0
    public void ClearControl(Control control, bool setcolor)
    {
        TextField     tf  = control as TextField;
        NumberField   nf  = control as NumberField;
        TextArea      ta  = control as TextArea;
        SpinnerField  sf  = control as SpinnerField;
        Checkbox      cb  = control as Checkbox;
        DropDownField ddf = control as DropDownField;
        ComboBox      cbb = control as ComboBox;
        DateField     df  = control as DateField;
        TriggerField  tgf = control as TriggerField;
        MultiCombo    mc  = control as MultiCombo;

        if (setcolor)
        {
            if (tgf != null)
            {
                tgf.Reset(); tgf.StyleSpec = "color:black";
            }
            if (df != null)
            {
                df.Reset();
                df.Call("setMaxValue", null);
                df.Call("setMinValue", null);
                df.StyleSpec = "color:black";
            }
            if (mc != null)
            {
                mc.Reset(); mc.StyleSpec = "color:black";
            }
            if (cbb != null)
            {
                cbb.Reset(); cbb.StyleSpec = "color:black";
            }
            if (ddf != null)
            {
                ddf.Reset(); ddf.StyleSpec = "color:black";
            }
            if (cb != null)
            {
                cb.Reset(); cb.StyleSpec = "color:black";
            }
            if (sf != null)
            {
                sf.Reset(); sf.StyleSpec = "color:black";
            }
            if (ta != null)
            {
                ta.Reset(); ta.StyleSpec = "color:black";
            }
            if (nf != null)
            {
                nf.Reset(); nf.StyleSpec = "color:black";
            }
            if (tf != null)
            {
                tf.Reset(); tf.StyleSpec = "color:black";
            }
            if (control.HasControls())
            {
                foreach (Control child in control.Controls)
                {
                    ClearControl(child, setcolor);
                }
            }
        }
        else
        {
            if (tgf != null)
            {
                tgf.Reset();
            }
            if (df != null)
            {
                df.Reset();
                df.Call("setMaxValue", null);
                df.Call("setMinValue", null);
            }
            if (mc != null)
            {
                mc.Reset();
            }
            if (cbb != null)
            {
                cbb.Reset();
            }
            if (ddf != null)
            {
                ddf.Reset();
            }
            if (cb != null)
            {
                cb.Reset();
            }
            if (sf != null)
            {
                sf.Reset();
            }
            if (ta != null)
            {
                ta.Reset();
            }
            if (nf != null)
            {
                nf.Reset();
            }
            if (tf != null)
            {
                tf.Reset();
            }
            if (control.HasControls())
            {
                foreach (Control child in control.Controls)
                {
                    ClearControl(child, setcolor);
                }
            }
        }
    }