示例#1
0
        /// <summary>
        /// Called when a data bound control needs to get the value back out of the control(s)
        /// created by this cell. Extract values from cell (presumably in edit mode)
        /// </summary>
        /// <param name="dictionary"></param>
        /// <param name="cell"></param>
        /// <param name="rowState"></param>
        /// <param name="includeReadOnly"></param>
        public override void ExtractValuesFromCell(System.Collections.Specialized.IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
        {
            object value = null;

            if (cell.Controls.Count > 0)
            {
                DropDownList dropDownList = cell.Controls[0] as DropDownList;
                if (dropDownList == null)
                {
                    throw new InvalidOperationException("DropDownField could not extract control.");
                }
                else
                {
                    value = dropDownList.SelectedValue;
                }
            }
            // Add the value to the dictionary
            if (dictionary.Contains(DataField))
            {
                dictionary[DataField] = value;
            }
            else
            {
                dictionary.Add(DataField, value);
            }
        }
示例#2
0
 protected override void ExtractValues(System.Collections.Specialized.IOrderedDictionary dictionary)
 {
     dictionary[Column.Name] = ConvertEditedValue(DropDownList1.SelectedValue);
 }