Пример #1
0
        public string GetngRadio(ExtControlBase controlBase)
        {
            NGRadio ngRadio = new NGRadio();

            ngRadio = controlBase as NGRadio;
            sb      = string.Format(@"
                    xtype: '{0}',
                    fieldLabel: Lang.{2}||'{1}',
                    id: '{3}_code',
                    itemId: '{3}_code',
                    name: '{3}_name',
                    mustInput: {4},
                    colspan: {5},
                    hidden: {6},
                    readOnly: {7},
                    x:{8},
                    y:{9},
                    width:{10},
                    vertical: true,
                    labelSeparator: '',
                    items:[
                 ", "radiogroup", controlBase.FieldLabel, FormTableName + "_" + controlBase.Name, controlBase.Name,
                                    controlBase.MustInput.Equals(true) && controlBase.Visible.Equals(true) ? "true" : "false", controlBase.ColSpan,
                                    controlBase.Visible.Equals(true) ? "false" : "true", controlBase.Protect.Equals(true) ? "true" : "false", controlBase.XPos,
                                    controlBase.YPos, controlBase.Width);

            for (int i = 0; i < ngRadio.Items.Count; i++)
            {
                //若是必输项,则默认选中第一项
                if (controlBase.MustInput && i == 0)
                {
                    sb += "\t\t\t\t\t\t\t\t{" + ngRadio.Items[i] + ", checked: true" + "}";
                }
                else
                {
                    sb += "\t\t\t\t\t\t\t\t{" + ngRadio.Items[i] + "}";
                }

                if (i == ngRadio.Items.Count - 1)
                {
                    sb += "\r\n";
                }
                else
                {
                    sb += ",\r\n";
                }
            }
            sb += "\t\t\t\t\t\t\t]\r\n\t\t\t\t\t\t";
            return(sb);
        }
Пример #2
0
        public static NGRadio GetRadio(PbBaseControlInfo pbCtl)
        {
            PbRadioboxInfo pbRadio = (PbRadioboxInfo)pbCtl;
            NGRadio        ngRadio = new NGRadio();

            ngRadio.ID         = pbRadio.Id;
            ngRadio.Name       = pbRadio.Name;
            ngRadio.FieldLabel = pbRadio.LeftText;
            ngRadio.MustInput  = pbRadio.IsMustInput;
            ngRadio.XType      = "ngRadio";
            ngRadio.Visible    = pbRadio.Visible;
            ngRadio.MustInput  = pbRadio.IsMustInput;
            ngRadio.Protect    = pbRadio.IsProtect;

            foreach (var info in pbRadio.PbPairValueInfos)
            {
                ngRadio.Items.Add(string.Format(@"boxLabel:'{0}',name:'{1}',inputValue:'{2}'",
                                                info.DisplayValue, pbRadio.Name, info.SaveValue));
            }
            return(ngRadio);
        }