Exemplo n.º 1
0
        public GenericItem(DataRow Row, int Mode)
        {
            _fieldName      = (string)Row["FieldName"];
            _fieldType      = (Row["FieldType"] as string).ToLower();
            _fieldAllowNull = false;

            if (_fieldType != "object" && _fieldType != "password" && !Row.IsNull("FieldAllowNull"))
            {
                _fieldAllowNull = (bool)Row["FieldAllowNull"];
            }


            _readOnly = false;
            if (!Row.IsNull("ReadOnly"))
            {
                _readOnly = (bool)Row["ReadOnly"];
            }

            _fieldTypeKey = "int";
            if (!Row.IsNull("FieldTypeKey"))
            {
                _fieldTypeKey = (string)Row["FieldTypeKey"];
            }

            if (_fieldType == TypeOfLookup)
            {
                _fieldLookup = (string)Row["FieldLookup"];
                if (!_fieldLookup.Contains(".xml"))
                {
                    _controllerInfo = (string)Row["ControllerInfo"];
                }
                _fieldLookupHelper = new IdNameHelper(_fieldLookup, _fieldAllowNull ? "*" : null, _fieldTypeKey, _controllerInfo);
            }

            if (_fieldAllowLink = !Row.IsNull("FieldUrlText"))
            {
                _fieldUrlName = (string)Row["FieldUrlName"];
                _fieldUrlText = (string)Row["FieldUrlText"];
            }

            _modeID      = Mode;
            _headerText  = (string)Row["HeaderText"];
            _headerWidth = (int)Row["ItemWidth"];
        }
Exemplo n.º 2
0
        public static DropDownList newDropDownList(string id, System.EventHandler e, IdNameHelper helper, bool hasEmpty, string defaultValue)
        {
            DropDownList d = new DropDownList();

            d.ID           = id;
            d.DataBinding += e;
            d.Width        = new Unit(100, UnitType.Percentage);
            if (hasEmpty)
            {
                d.Items.Add(string.Empty);
            }
            helper.PopulateList(d);
            if (defaultValue != null)
            {
                ListItem i = (ListItem)d.Items.FindByValue(defaultValue);
                if (i != null)
                {
                    i.Selected = true;
                }
            }

            return(d);
        }