Ejemplo n.º 1
0
        public override void ExtractValuesFromCell(System.Collections.Specialized.IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
        {
            if (String.IsNullOrEmpty(this.DataField))
            {
                return;
            }

            if (cell == null || dictionary == null)
            {
                return;
            }

            Object value = null;

            if (cell.Controls.Count > 0)
            {
                ISelectorFieldControl selector = cell.Controls[0] as ISelectorFieldControl;
                if (selector != null)
                {
                    value = selector.Selected;
                }
            }
            if (value != null)
            {
                if (dictionary.Contains(this.DataField))
                {
                    dictionary[this.DataField] = value;
                }
                else
                {
                    dictionary.Add(this.DataField, value);
                }
            }
        }
Ejemplo n.º 2
0
        /// <exclude/>
        protected virtual void DataBindField(Control selector)
        {
            Object  dataItem        = DataBinder.GetDataItem(selector.NamingContainer);
            Object  itemValueObject = DataBinder.GetPropertyValue(dataItem, this.DataField);
            Boolean dataValue       = (itemValueObject != null) ? Convert.ToBoolean(itemValueObject, CultureInfo.InvariantCulture) : false;

            ISelectorFieldControl iSelector = selector as ISelectorFieldControl;

            iSelector.Selected = dataValue;
        }
Ejemplo n.º 3
0
        protected virtual void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState, Int32 rowIndex)
        {
            if ((rowState & DataControlRowState.Insert) == DataControlRowState.Insert)
            {
                return;
            }

            Control selector = this.CreateSelectorControl();

            cell.Controls.Add(selector);

            ISelectorFieldControl iSelector = selector as ISelectorFieldControl;

            iSelector.AutoPostBack = this.AutoPostBack;
            iSelector.Index        = rowIndex;

            this.selectors.Add(iSelector);

            if (!String.IsNullOrEmpty(this.DataField))
            {
                selector.DataBinding += new EventHandler(selector_DataBinding);
            }
        }