protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
 {
     //base.InitializeDataCell(cell, rowState);
     TextBox textBox = new TextBox();
     textBox.ID = this.ControlID;
     textBox.Width = new Unit(GridColumn.Width, UnitType.Pixel);
     if (GridColumn.Size != 0) textBox.MaxLength = GridColumn.Size;
     textBox.DataBinding += new EventHandler(this.textBox_DataBinding);
     base.InitializeDataCell(cell, rowState);
     cell.Controls.Add(textBox);
     CompareValidator vld = new CompareValidator();
     vld.ControlToValidate = textBox.ID;
     vld.ID = textBox.ID + "vld";
     vld.Operator = ValidationCompareOperator.DataTypeCheck;
     vld.ErrorMessage = "не верный формат (2)";
     vld.Text = "! (2)";
     vld.Display = ValidatorDisplay.Dynamic;
     if (GridColumn.Type == typeof(int)) vld.Type = ValidationDataType.Integer;
     if (GridColumn.Type == typeof(decimal)) vld.Type = ValidationDataType.Double;
     if (GridColumn.Type == typeof(string)) vld.Type = ValidationDataType.String;
     cell.Controls.Add(vld);
     if (!GridColumn.AllowNULL)
     {
         RequiredFieldValidator reqvld = new RequiredFieldValidator();
         reqvld.ControlToValidate = textBox.ID;
         reqvld.ID = textBox.ID + "reqvld";
         reqvld.ErrorMessage = "поле не может быть пустым (1)";
         reqvld.Text = "! (1)";
         reqvld.Display = ValidatorDisplay.Dynamic;
         cell.Controls.Add(reqvld);
     }
 }
예제 #2
0
        public HyperLink CreateControlLink(DataControlFieldCell cell
            , String IdPropertyName
            , String controllerObjectName
            , String onClickClientEvent
            , String imageUrl
            , String altText
            , Int32 columnIndex
            , String businessKeyProperty
            )
        {
            GridViewRow row = (GridViewRow)cell.BindingContainer;
            if (row == null)
                return null;

            String value = GetObjectValue(row.DataItem, IdPropertyName);
            String businessKeyPropertyValue = GetObjectValue(row.DataItem, businessKeyProperty);

            if (String.IsNullOrEmpty(cell.Text) || String.Compare(cell.Text, " ") == 0 ||
                    String.IsNullOrEmpty(value))
                return null;

            HyperLink link = new HyperLink();

            link.Text = cell.Text;
            link.NavigateUrl = GetNavigationUrl(value, businessKeyPropertyValue, controllerObjectName, onClickClientEvent, columnIndex);

            if (!String.IsNullOrEmpty(imageUrl))
                link.Controls.Add(CreateImage(imageUrl, altText));

            _navigateURL = link.NavigateUrl;
            _text = link.Text;
            _image = imageUrl;

            return link;
        }
예제 #3
0
        public override void InitializeCell(
            DataControlFieldCell cell,
            DataControlCellType cellType,
            DataControlRowState rowState,
            int rowIndex)
        {
            if (cellType == DataControlCellType.DataCell)
               {
                    var control = new DynamicControl() { DataField = DataField };

                    // Copy various properties into the control
                    control.UIHint = UIHint;
                    control.HtmlEncode = HtmlEncode;
                    control.NullDisplayText = NullDisplayText;

                    // this the default for DynamicControl and has to be
                    // manually changed you do not need this line of code
                    // its there just to remind us what we are doing.
                    control.Mode = DataBoundControlMode.ReadOnly;

                    cell.Controls.Add(control);
               }
               else
               {
                    base.InitializeCell(cell, cellType, rowState, rowIndex);
               }
        }
예제 #4
0
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            chkBox = new CheckBox {ID = "chkBool", Enabled = false};
            cell.Controls.Add(chkBox);

            base.InitializeCell(cell, cellType, rowState, rowIndex);
        }
예제 #5
0
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            base.InitializeCell(cell, cellType, rowState, rowIndex);

            if (ColumnStyle != null)
            {
                if (HeaderStyle.CssClass.IsNullOrEmpty()) HeaderStyle.CssClass = ColumnStyle;
                if (ItemStyle.CssClass.IsNullOrEmpty()) ItemStyle.CssClass = ColumnStyle;
                if (FooterStyle.CssClass.IsNullOrEmpty()) FooterStyle.CssClass = ColumnStyle;
            }

            if (cellType != DataControlCellType.DataCell) return;
            ButtonEx buttonEx = string.IsNullOrEmpty(Message) ? new ButtonEx() : new MessageButton { Message = Message};
            buttonEx.CommandName = CommandName;
            buttonEx.ToolTip = ResourceManager.GetString(ToolTip);
            buttonEx.LeftIconCssClass = IconName == null ? string.Empty : IconName.Name;
            buttonEx.ShowText = false;
            buttonEx.OnClientClick = OnClickClick;
            if (Click != null)
            {
                if (buttonEx is MessageButton)
                    ((MessageButton) buttonEx).Confirm += Click;
                else
                    buttonEx.Click += Click;
            }
            cell.Controls.Add(buttonEx);
        }
예제 #6
0
 protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
 {
     DropDownList ddl = new DropDownList();
     ddl.Items.Add("");
     ddl.AppendDataBoundItems = true;
     if (!string.IsNullOrEmpty(this.DataSourceID) || null != this.DataSource)
     {
         if (!string.IsNullOrEmpty(this.DataSourceID))
         {
             ddl.DataSourceID = this.DataSourceID;
         }
         else
         {
             ddl.DataSource = this.DataSource;
         }
         ddl.DataTextField = this.DataTextField;
         ddl.DataValueField = this.DataValueField;
     }
     if (this.DataField.Length != 0)
     {
         ddl.DataBound += new EventHandler(this.OnDataBindField);
     }
     ddl.Enabled = false;
     if ((rowState & DataControlRowState.Edit) != DataControlRowState.Normal || (rowState & DataControlRowState.Insert) != DataControlRowState.Normal)
     {
         ddl.Enabled = true;
     }
     cell.Controls.Add(ddl);
 }
예제 #7
0
 public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
     base.InitializeCell(cell, cellType, rowState, rowIndex);
     if (cell == null)
     {
         throw new ArgumentNullException("cell");
     }
     ImageButton button3 = new ImageButton {
         ID = "rise",
         ImageUrl = this.RiseUrl,
         CommandName = "Rise"
     };
     ImageButton child = button3;
     ImageButton button4 = new ImageButton {
         ID = "fall",
         ImageUrl = this.FallUrl,
         CommandName = "Fall"
     };
     ImageButton button2 = button4;
     if (cellType == DataControlCellType.DataCell)
     {
         cell.Controls.Add(button2);
         cell.Controls.Add(child);
     }
 }
 public override void ExtractValuesFromCell(IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
 {
     Control control = null;
     string dataField = this.DataField;
     object obj2 = null;
     if (cell.Controls.Count > 0)
     {
         control = cell.Controls[0];
         CheckBox box = control as CheckBox;
         if ((box != null) && (includeReadOnly || box.Enabled))
         {
             obj2 = box.Checked;
         }
     }
     if (obj2 != null)
     {
         if (dictionary.Contains(dataField))
         {
             dictionary[dataField] = obj2;
         }
         else
         {
             dictionary.Add(dataField, obj2);
         }
     }
 }
 protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
 {
     CheckBox child = null;
     CheckBox box2 = null;
     if ((((rowState & DataControlRowState.Edit) != DataControlRowState.Normal) && !this.ReadOnly) || ((rowState & DataControlRowState.Insert) != DataControlRowState.Normal))
     {
         CheckBox box3 = new CheckBox {
             ToolTip = this.HeaderText
         };
         child = box3;
         if ((this.DataField.Length != 0) && ((rowState & DataControlRowState.Edit) != DataControlRowState.Normal))
         {
             box2 = box3;
         }
     }
     else if (this.DataField.Length != 0)
     {
         CheckBox box4 = new CheckBox {
             Text = this.Text,
             Enabled = false
         };
         child = box4;
         box2 = box4;
     }
     if (child != null)
     {
         cell.Controls.Add(child);
     }
     if ((box2 != null) && base.Visible)
     {
         box2.DataBinding += new EventHandler(this.OnDataBindField);
     }
 }
예제 #10
0
파일: TooltipField.cs 프로젝트: NLADP/ADF
        protected override void InitializeControls(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            image = new Image();
            image.SetId(ChildId);

            cell.Controls.Add(image);
        }
예제 #11
0
		void Case0 (DataControlFieldCell cell)
		{
			CheckBox checkBox = new CheckBox();
			checkBox.ToolTip = "Dummy";
			cell.Controls.Add(checkBox);
			checkBox.DataBinding += OnDataBindField;
		}
예제 #12
0
파일: TextButton.cs 프로젝트: NLADP/ADF
        protected override void InitializeControls(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            button = new LinkButton { CommandName = CommandName };
            button.SetId(ChildId);

            if (Click != null) button.Click += Click;

            cell.Controls.Add(button);

            tooltipbutton = new LinkButton { CommandName = CommandName, Visible = false};
            tooltipbutton.SetId(ChildId);

            cell.Controls.Add(tooltipbutton);

            if (ShowLabelIfDisabled)
            {
                labelIfDisabled = new Label { Visible = false };

                cell.Controls.Add(labelIfDisabled);

                tooltiplabelIfDisabled = new Label { Visible = false };

                cell.Controls.Add(tooltiplabelIfDisabled);
            }
        }
예제 #13
0
 protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
 {
     //base.InitializeDataCell(cell, rowState);
     HyperLink link = new HyperLink();
     link.DataBinding += new EventHandler(this.link_DataBinding);
     link.CssClass = "thickbox";
     cell.Controls.Add(link);
 }
예제 #14
0
		public override void ExtractValuesFromCell(System.Collections.Specialized.IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
		{
			if (rowState == DataControlRowState.Normal)
			{

			}

			base.ExtractValuesFromCell(dictionary, cell, rowState, includeReadOnly);
		}
예제 #15
0
			protected override void InitializeDataCell (DataControlFieldCell cell, DataControlRowState rowState)
			{
				if ((rowState & DataControlRowState.Edit) != DataControlRowState.Normal) {
					TextBox textBox = new TextBox ();
					cell.Controls.Add (textBox);
					textBox.DataBinding += OnDataBindField;
				} else
					base.InitializeDataCell (cell, rowState);
			}
예제 #16
0
파일: IconButton.cs 프로젝트: NLADP/ADF
        protected override void InitializeControls(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            button = new ImageButton { ImageUrl = "", CommandName = CommandName };
            button.SetId(ChildId);

            if (Click != null) button.Click += Click;

            cell.Controls.Add(button);
        }
 protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
 {
     //base.InitializeDataCell(cell, rowState);
     CheckBox checkBox = new CheckBox();
     checkBox.ID = this.ControlID;
     base.InitializeDataCell(cell, rowState);
     checkBox.EnableViewState = true;
     checkBox.DataBinding += new EventHandler(this.checkBox_DataBinding);
     cell.Controls.Add(checkBox);
 }
예제 #18
0
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            base.InitializeCell(cell, cellType, rowState, rowIndex);

            // We need to have a header that has a sort expression.
            if (cellType == DataControlCellType.Header && !string.IsNullOrWhiteSpace(this.SortExpression))
            {
                cell.Controls.Add(Common.CreatePinningButton(IsPinned, IsPinnable, this.SortExpression, Toggle_Click));
            }
        }
예제 #19
0
		public void AutoGeneratedField_ExtractValuesFromCell()
		{
			AutoGeneratedField field = new AutoGeneratedField ("field");
			OrderedDictionary dictionary = new OrderedDictionary ();
			DataControlFieldCell cell = new DataControlFieldCell (null);
			cell.Text = "cell";
			field.ExtractValuesFromCell (dictionary, cell, DataControlRowState.Normal, true);
			Assert.AreEqual (1, dictionary.Count, "ExtractValuesFromCellCount");
			Assert.AreEqual ("cell", dictionary[0].ToString (), "ExtractValuesFromCellValue");
		}
예제 #20
0
        protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
        {
            base.InitializeDataCell(cell, rowState);

            if ((cell.Controls.Count == 0))
            {
                CheckBox chk = new CheckBox();
                chk.ID = SelectionField.DefaultSelectionCheckBoxID;
                cell.Controls.Add(chk);
            }
        }
예제 #21
0
        /// <summary>
        /// 初始化单元格
        /// </summary>
        /// <param name="cell"></param>
        /// <param name="cellType"></param>
        /// <param name="rowState"></param>
        /// <param name="rowIndex"></param>
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            base.InitializeCell(cell, cellType, rowState, rowIndex);
            if (cell.Controls.Count < 1) return;

            HyperLink link = cell.Controls[cell.Controls.Count - 1] as HyperLink;
            if (link == null) return;
            link.PreRender += new EventHandler(link_PreRender);

            InitializeControl(link);
        }
예제 #22
0
		void Case3 (DataControlFieldCell cell)
		{
			Content content = new Content ();
    	    
			CheckBox checkBox = new CheckBox();
			checkBox.ToolTip = "Dummy";
			content.Controls.Add(checkBox);
			checkBox.DataBinding += OnDataBindField;
            
			cell.Controls.Add (content);
		}
 public override void ExtractValuesFromCell(IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
 {
     Control control = null;
     string dataField = this.DataField;
     object text = null;
     string nullDisplayText = this.NullDisplayText;
     if (((rowState & DataControlRowState.Insert) == DataControlRowState.Normal) || this.InsertVisible)
     {
         if (cell.Controls.Count > 0)
         {
             control = cell.Controls[0];
             TextBox box = control as TextBox;
             if (box != null)
             {
                 text = box.Text;
             }
         }
         else if (includeReadOnly)
         {
             string s = cell.Text;
             if (s == "&nbsp;")
             {
                 text = string.Empty;
             }
             else if (this.SupportsHtmlEncode && this.HtmlEncode)
             {
                 text = HttpUtility.HtmlDecode(s);
             }
             else
             {
                 text = s;
             }
         }
         if (text != null)
         {
             if (((text is string) && (((string) text).Length == 0)) && this.ConvertEmptyStringToNull)
             {
                 text = null;
             }
             if (((text is string) && (((string) text) == nullDisplayText)) && (nullDisplayText.Length > 0))
             {
                 text = null;
             }
             if (dictionary.Contains(dataField))
             {
                 dictionary[dataField] = text;
             }
             else
             {
                 dictionary.Add(dataField, text);
             }
         }
     }
 }
        private void AddButtonToCell(DataControlFieldCell cell, string commandName, string buttonText, bool causesValidation, string validationGroup, int rowIndex, string imageUrl)
        {
            IButtonControl control;
            IPostBackContainer container = base.Control as IPostBackContainer;
            bool flag = true;
            switch (this.ButtonType)
            {
                case ButtonType.Button:
                    if ((container == null) || causesValidation)
                    {
                        control = new Button();
                    }
                    else
                    {
                        control = new DataControlButton(container);
                        flag = false;
                    }
                    break;

                case ButtonType.Link:
                    if ((container == null) || causesValidation)
                    {
                        control = new DataControlLinkButton(null);
                    }
                    else
                    {
                        control = new DataControlLinkButton(container);
                        flag = false;
                    }
                    break;

                default:
                    if ((container != null) && !causesValidation)
                    {
                        control = new DataControlImageButton(container);
                        flag = false;
                    }
                    else
                    {
                        control = new ImageButton();
                    }
                    ((ImageButton) control).ImageUrl = imageUrl;
                    break;
            }
            control.Text = buttonText;
            control.CommandName = commandName;
            control.CommandArgument = rowIndex.ToString(CultureInfo.InvariantCulture);
            if (flag)
            {
                control.CausesValidation = causesValidation;
            }
            control.ValidationGroup = validationGroup;
            cell.Controls.Add((WebControl) control);
        }
 protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
 {
     DropDownList dropDown = new DropDownList();
     dropDown.DataValueField = GridColumn.DataSource.ValueField;
     dropDown.DataTextField = GridColumn.DataSource.TextField;
     dropDown.DataSource = GridColumn.DataSource.DataSource;
     dropDown.ID = this.ControlID;
     base.InitializeDataCell(cell, rowState);
     dropDown.DataBound += new EventHandler(dropDown_DataBound);
     cell.Controls.Add(dropDown);
 }
예제 #26
0
 public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
     base.InitializeCell(cell, cellType, rowState, rowIndex);
     if (cellType == DataControlCellType.DataCell)
     {
         InitializeDataCell(cell, rowState);
         if ((rowState & DataControlRowState.Insert) == 0)
         {
             cell.DataBinding += new EventHandler(OnDataBindField);
         }
     }
 }
예제 #27
0
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType,
                                            DataControlRowState rowState, int rowIndex)
        {
            base.InitializeCell(cell, cellType, rowState, rowIndex);

            switch (cellType)
            {
                case DataControlCellType.DataCell:
                    cell.DataBinding += ItemDataBinding;
                    break;
            }
        }
예제 #28
0
		public override void ExtractValuesFromCell (IOrderedDictionary dictionary,
			DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
		{
			if (dataType == typeof(bool)) {
				bool editable = IsEditable (rowState);
				if (editable || includeReadOnly) {
					CheckBox box = (CheckBox) cell.Controls [0];
					dictionary [DataField] = box.Checked;
				}
			} else
				base.ExtractValuesFromCell (dictionary, cell, rowState, includeReadOnly);
		}
예제 #29
0
 public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
     base.InitializeCell(cell, cellType, rowState, rowIndex);
     if (null == cell)
     {
         throw new ArgumentNullException("cell");
     }
     if (cellType == DataControlCellType.DataCell)
     {
         cell.DataBinding += new EventHandler(this.cell_DataBinding);
     }
 }
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            base.InitializeCell(cell, cellType, rowState, rowIndex);
            ITemplate headerTemplate = null;

            switch (cellType)
            {
            case DataControlCellType.Header:
                headerTemplate = this.headerTemplate;
                break;

            case DataControlCellType.Footer:
                headerTemplate = this.footerTemplate;
                break;

            case DataControlCellType.DataCell:
                headerTemplate = this.itemTemplate;
                if ((rowState & DataControlRowState.Edit) == DataControlRowState.Normal)
                {
                    if ((rowState & DataControlRowState.Insert) != DataControlRowState.Normal)
                    {
                        if (this.insertItemTemplate != null)
                        {
                            headerTemplate = this.insertItemTemplate;
                        }
                        else if (this.editItemTemplate != null)
                        {
                            headerTemplate = this.editItemTemplate;
                        }
                    }
                    else if (((rowState & DataControlRowState.Alternate) != DataControlRowState.Normal) && (this.alternatingItemTemplate != null))
                    {
                        headerTemplate = this.alternatingItemTemplate;
                    }
                    break;
                }
                if (this.editItemTemplate != null)
                {
                    headerTemplate = this.editItemTemplate;
                }
                break;
            }
            if (headerTemplate != null)
            {
                cell.Text = string.Empty;
                headerTemplate.InstantiateIn(cell);
            }
            else if (cellType == DataControlCellType.DataCell)
            {
                cell.Text = "&nbsp;";
            }
        }
예제 #31
0
        protected override void OnDataBindField(object sender, EventArgs e)
        {
            try {
                Control  container = (Control)sender;
                object   val       = GetValue(container.NamingContainer);
                CheckBox box       = sender as CheckBox;
                if (box == null)
                {
                    DataControlFieldCell cell = sender as DataControlFieldCell;
                    if (cell != null)
                    {
                        ControlCollection controls = cell.Controls;
                        int ccount = controls != null ? controls.Count : 0;
                        if (ccount == 1)
                        {
                            box = controls [0] as CheckBox;
                        }
                        if (box == null)
                        {
                            return;
                        }
                    }
                }

                if (box == null)
                {
                    throw new HttpException("CheckBox field '" + DataField + "' contains a control that isn't a CheckBox.  Override OnDataBindField to inherit from CheckBoxField and add different controls.");
                }

                if (val != null && val != DBNull.Value)
                {
                    box.Checked = (bool)val;
                }
                else
                {
                    if (string.IsNullOrEmpty(DataField))
                    {
                        box.Visible = false;
                        return;
                    }
                }

                if (!box.Visible)
                {
                    box.Visible = true;
                }
            } catch (HttpException) {
                throw;
            } catch (Exception ex) {
                throw new HttpException(ex.Message, ex);
            }
        }
예제 #32
0
        protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
        {
            bool     editable = IsEditable(rowState);
            CheckBox box      = new CheckBox();

            box.Enabled = editable;
            if (editable)
            {
                box.ToolTip = HeaderText;
            }
            box.Text = Text;
            cell.Controls.Add(box);
        }
예제 #33
0
        //CheckBoxField.InitializeDataCell 方法 :将指定的 DataControlFieldCell 对象初始化为指定的行状态
        //InitializeDataCell 方法是一种 Helper 方法,用于初始化 CheckBoxField 对象中的单元格
        protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
        {
            base.InitializeDataCell(cell, rowState);

            // Add a checkbox anyway, if not done already
            if (cell.Controls.Count == 0)
            {
                CheckBox chk = new CheckBox();
                
                chk.ID = InputCheckBoxField.CheckBoxID;
                cell.Controls.Add(chk);
            }
        }
예제 #34
0
        /// <summary>
        /// Adds text or controls to a cell's controls collection.
        /// </summary>
        /// <param name="cell">A <see cref="T:System.Web.UI.WebControls.DataControlFieldCell" /> that contains the text or controls of the <see cref="T:System.Web.UI.WebControls.DataControlField" />.</param>
        /// <param name="cellType">One of the <see cref="T:System.Web.UI.WebControls.DataControlCellType" /> values.</param>
        /// <param name="rowState">One of the <see cref="T:System.Web.UI.WebControls.DataControlRowState" /> values, specifying the state of the row that contains the <see cref="T:System.Web.UI.WebControls.DataControlFieldCell" />.</param>
        /// <param name="rowIndex">The index of the row that the <see cref="T:System.Web.UI.WebControls.DataControlFieldCell" /> is contained in.</param>
        public override void InitializeCell( DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex )
        {
            if ( cellType == DataControlCellType.Header )
            {
                if ( !string.IsNullOrEmpty( this.HeaderStyle.CssClass ) )
                {
                    // make sure the header cell sets the CssClass
                    cell.AddCssClass( this.HeaderStyle.CssClass );
                }
            }

            base.InitializeCell( cell, cellType, rowState, rowIndex );
        }
 protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
 {
     if (dataType == typeof(bool))
     {
         bool     editable = IsEditable(rowState);
         CheckBox box      = new CheckBox();
         box.Enabled = editable;
         box.ToolTip = HeaderText;
         cell.Controls.Add(box);
     }
     else
     {
         base.InitializeDataCell(cell, rowState);
     }
 }
        public override void ExtractValuesFromCell(IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
        {
            Control control           = null;
            string  dataImageUrlField = this.DataImageUrlField;
            object  imageUrl          = null;
            bool    flag = false;

            if ((((rowState & DataControlRowState.Insert) == DataControlRowState.Normal) || this.InsertVisible) && (cell.Controls.Count != 0))
            {
                control = cell.Controls[0];
                Image image = control as Image;
                if (image != null)
                {
                    if (includeReadOnly)
                    {
                        flag = true;
                        if (image.Visible)
                        {
                            imageUrl = image.ImageUrl;
                        }
                    }
                }
                else
                {
                    TextBox box = control as TextBox;
                    if (box != null)
                    {
                        imageUrl = box.Text;
                        flag     = true;
                    }
                }
                if ((imageUrl != null) || flag)
                {
                    if ((this.ConvertEmptyStringToNull && (imageUrl is string)) && (((string)imageUrl).Length == 0))
                    {
                        imageUrl = null;
                    }
                    if (dictionary.Contains(dataImageUrlField))
                    {
                        dictionary[dataImageUrlField] = imageUrl;
                    }
                    else
                    {
                        dictionary.Add(dataImageUrlField, imageUrl);
                    }
                }
            }
        }
예제 #37
0
 public override void InitializeCell(DataControlFieldCell cell,
                                     DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
     base.InitializeCell(cell, cellType, rowState, rowIndex);
     if (cellType == DataControlCellType.Header)
     {
         if (headerTemplate != null && ShowHeader)
         {
             cell.Text = String.Empty;
             headerTemplate.InstantiateIn(cell);
         }
     }
     else if (cellType == DataControlCellType.Footer)
     {
         if (footerTemplate != null)
         {
             cell.Text = String.Empty;
             footerTemplate.InstantiateIn(cell);
         }
     }
     else
     {
         cell.Text = String.Empty;
         if ((rowState & DataControlRowState.Insert) != 0 &&
             insertItemTemplate != null)
         {
             insertItemTemplate.InstantiateIn(cell);
         }
         else if ((rowState & DataControlRowState.Edit) != 0 &&
                  editItemTemplate != null)
         {
             editItemTemplate.InstantiateIn(cell);
         }
         else if ((rowState & DataControlRowState.Alternate) != 0 &&
                  alternatingItemTemplate != null)
         {
             alternatingItemTemplate.InstantiateIn(cell);
         }
         else if (itemTemplate != null)
         {
             itemTemplate.InstantiateIn(cell);
         }
         else
         {
             cell.Text = "&nbsp;";
         }
     }
 }
        protected virtual void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
        {
            bool editable = (rowState & (DataControlRowState.Edit | DataControlRowState.Insert)) != 0;

            if (editable && !ReadOnly)
            {
                TextBox box = new TextBox();
                cell.Controls.Add(box);
            }
            else if (DataImageUrlField.Length > 0)
            {
                Image img = new Image();
                img.ControlStyle.CopyFrom(ControlStyle);
                cell.Controls.Add(img);
            }
        }
예제 #39
0
        /// <devdoc>
        /// Extracts the value(s) from the given cell and puts the value(s) into a dictionary.  Indicate includeReadOnly
        /// to have readonly fields' values inserted into the dictionary.
        /// </devdoc>
        public override void ExtractValuesFromCell(IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
        {
            DataBoundControlHelper.ExtractValuesFromBindableControls(dictionary, cell);

            IBindableTemplate bindableTemplate = ItemTemplate as IBindableTemplate;

            if (((rowState & DataControlRowState.Alternate) != 0) && (AlternatingItemTemplate != null))
            {
                bindableTemplate = AlternatingItemTemplate as IBindableTemplate;
            }
            if (((rowState & DataControlRowState.Edit) != 0) && EditItemTemplate != null)
            {
                bindableTemplate = EditItemTemplate as IBindableTemplate;
            }
            else if ((rowState & DataControlRowState.Insert) != 0 && InsertVisible)
            {
                if (InsertItemTemplate != null)
                {
                    bindableTemplate = InsertItemTemplate as IBindableTemplate;
                }
                else
                {
                    if (EditItemTemplate != null)
                    {
                        bindableTemplate = EditItemTemplate as IBindableTemplate;
                    }
                }
            }

            if (bindableTemplate != null)
            {
                bool convertEmptyStringToNull = ConvertEmptyStringToNull;
                foreach (DictionaryEntry entry in bindableTemplate.ExtractValues(cell.BindingContainer))
                {
                    object value = entry.Value;
                    if (convertEmptyStringToNull && value is string && ((string)value).Length == 0)
                    {
                        dictionary[entry.Key] = null;
                    }
                    else
                    {
                        dictionary[entry.Key] = value;
                    }
                }
            }
            return;
        }
 public override void ExtractValuesFromCell(IOrderedDictionary dictionary,
                                            DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
 {
     if (dataType == typeof(bool))
     {
         bool editable = IsEditable(rowState);
         if (editable || includeReadOnly)
         {
             CheckBox box = (CheckBox)cell.Controls [0];
             dictionary [DataField] = box.Checked;
         }
     }
     else
     {
         base.ExtractValuesFromCell(dictionary, cell, rowState, includeReadOnly);
     }
 }
예제 #41
0
        public override void ExtractValuesFromCell(IOrderedDictionary dictionary,
                                                   DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
        {
            bool editable = IsEditable(rowState);

            if (editable)
            {
                if (cell.Controls.Count > 0)
                {
                    TextBox box = (TextBox)cell.Controls [0];
                    dictionary [DataField] = box.Text;
                }
            }
            else if (includeReadOnly)
            {
                dictionary [DataField] = cell.Text;
            }
        }
예제 #42
0
        protected virtual void OnDataBindField(object sender, EventArgs e)
        {
            DataControlFieldCell cell = (DataControlFieldCell)sender;

            if (cell.Controls.Count == 0)
            {
                return;
            }

            if (imageProperty == null)
            {
                imageProperty = GetProperty(cell.BindingContainer, DataImageUrlField);
            }

            Control c = cell.Controls [0];

            if (c is TextBox)
            {
                object val = GetValue(cell.BindingContainer, DataImageUrlField, ref imageProperty);
                ((TextBox)c).Text = val != null?val.ToString() : "";
            }
            else if (c is Image)
            {
                Image  img   = (Image)c;
                string value = FormatImageUrlValue(GetValue(cell.BindingContainer, DataImageUrlField, ref imageProperty));
                if (value == null || (ConvertEmptyStringToNull && value.Length == 0))
                {
                    if (NullImageUrl == null || NullImageUrl.Length == 0)
                    {
                        c.Visible = false;
                        Label label = new Label();
                        label.Text = NullDisplayText;
                        cell.Controls.Add(label);
                    }
                    else
                    {
                        value = NullImageUrl;
                    }
                }
                img.ImageUrl      = value;
                img.AlternateText = GetFormattedAlternateText(cell.BindingContainer);
            }
        }
예제 #43
0
        public override void InitializeCell(DataControlFieldCell cell,
                                            DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            base.InitializeCell(cell, cellType, rowState, rowIndex);
            if (cellType == DataControlCellType.DataCell)
            {
                HyperLink link = new HyperLink();
                bool      bind = false;

                if (Target.Length > 0)
                {
                    link.Target = Target;
                }

                if (DataTextField.Length > 0)
                {
                    bind = true;
                }
                else
                {
                    link.Text = Text;
                }

                string [] fields = DataNavigateUrlFields;
                if (fields.Length > 0)
                {
                    bind = true;
                }
                else
                {
                    link.NavigateUrl = NavigateUrl;
                }

                if (bind && cellType == DataControlCellType.DataCell && (rowState & DataControlRowState.Insert) == 0)
                {
                    cell.DataBinding += new EventHandler(OnDataBindField);
                }

                link.ControlStyle.CopyFrom(ControlStyle);

                cell.Controls.Add(link);
            }
        }
예제 #44
0
 public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
     base.InitializeCell(cell, cellType, rowState, rowIndex);
     if (cellType == DataControlCellType.DataCell)
     {
         HyperLink child = new HyperLink {
             Text        = this.Text,
             NavigateUrl = this.NavigateUrl,
             Target      = this.Target
         };
         if (((rowState & DataControlRowState.Insert) == DataControlRowState.Normal) && base.Visible)
         {
             if ((this.DataNavigateUrlFields.Length != 0) || (this.DataTextField.Length != 0))
             {
                 child.DataBinding += new EventHandler(this.OnDataBindField);
             }
             cell.Controls.Add(child);
         }
     }
 }
        public override void ExtractValuesFromCell(IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
        {
            DataBoundControlHelper.ExtractValuesFromBindableControls(dictionary, cell);
            IBindableTemplate itemTemplate = this.ItemTemplate as IBindableTemplate;

            if (((rowState & DataControlRowState.Alternate) != DataControlRowState.Normal) && (this.AlternatingItemTemplate != null))
            {
                itemTemplate = this.AlternatingItemTemplate as IBindableTemplate;
            }
            if (((rowState & DataControlRowState.Edit) != DataControlRowState.Normal) && (this.EditItemTemplate != null))
            {
                itemTemplate = this.EditItemTemplate as IBindableTemplate;
            }
            else if (((rowState & DataControlRowState.Insert) != DataControlRowState.Normal) && this.InsertVisible)
            {
                if (this.InsertItemTemplate != null)
                {
                    itemTemplate = this.InsertItemTemplate as IBindableTemplate;
                }
                else if (this.EditItemTemplate != null)
                {
                    itemTemplate = this.EditItemTemplate as IBindableTemplate;
                }
            }
            if (itemTemplate != null)
            {
                bool convertEmptyStringToNull = this.ConvertEmptyStringToNull;
                foreach (DictionaryEntry entry in itemTemplate.ExtractValues(cell.BindingContainer))
                {
                    object obj2 = entry.Value;
                    if ((convertEmptyStringToNull && (obj2 is string)) && (((string)obj2).Length == 0))
                    {
                        dictionary[entry.Key] = null;
                    }
                    else
                    {
                        dictionary[entry.Key] = obj2;
                    }
                }
            }
        }
예제 #46
0
        protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
        {
            if (UseCheckBox)
            {
                CheckBox childControl = null;
                CheckBox boundControl = null;

                if (((rowState & DataControlRowState.Edit) != 0 && ReadOnly == false) || (rowState & DataControlRowState.Insert) != 0)
                {
                    CheckBox editor = new CheckBox();
                    childControl = editor;

                    if (DataField.Length != 0 && (rowState & DataControlRowState.Edit) != 0)
                    {
                        boundControl = editor;
                    }
                }
                else if (DataField.Length != 0)
                {
                    CheckBox editor = new CheckBox();
                    editor.Enabled = false;
                    childControl   = editor;
                    boundControl   = editor;
                }

                if (childControl != null)
                {
                    childControl.ToolTip = HeaderText;
                    cell.Controls.Add(childControl);
                }

                if (boundControl != null)
                {
                    boundControl.DataBinding += new EventHandler(this.OnDataBindField);
                }
            }
            else
            {
                base.InitializeDataCell(cell, rowState);
            }
        }
예제 #47
0
        /// <devdoc>
        /// Extracts the value of the databound cell and inserts the value into the given dictionary
        /// </devdoc>
        public override void ExtractValuesFromCell(IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
        {
            if (UseCheckBox)
            {
                Control childControl = null;
                string  dataField    = DataField;
                object  value        = null;

                if (cell.Controls.Count > 0)
                {
                    childControl = cell.Controls[0];

                    CheckBox checkBox = childControl as CheckBox;
                    if (checkBox != null)
                    {
                        if (includeReadOnly || checkBox.Enabled)
                        {
                            value = checkBox.Checked;
                        }
                    }
                }

                if (value != null)
                {
                    if (dictionary.Contains(dataField))
                    {
                        dictionary[dataField] = value;
                    }
                    else
                    {
                        dictionary.Add(dataField, value);
                    }
                }
            }
            else
            {
                base.ExtractValuesFromCell(dictionary, cell, rowState, includeReadOnly);
            }
        }
 protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
 {
     if (this.UseCheckBox)
     {
         CheckBox child = null;
         CheckBox box2  = null;
         if ((((rowState & DataControlRowState.Edit) != DataControlRowState.Normal) && !this.ReadOnly) || ((rowState & DataControlRowState.Insert) != DataControlRowState.Normal))
         {
             CheckBox box3 = new CheckBox();
             child = box3;
             if ((this.DataField.Length != 0) && ((rowState & DataControlRowState.Edit) != DataControlRowState.Normal))
             {
                 box2 = box3;
             }
         }
         else if (this.DataField.Length != 0)
         {
             CheckBox box4 = new CheckBox {
                 Enabled = false
             };
             child = box4;
             box2  = box4;
         }
         if (child != null)
         {
             child.ToolTip = this.HeaderText;
             cell.Controls.Add(child);
         }
         if (box2 != null)
         {
             box2.DataBinding += new EventHandler(this.OnDataBindField);
         }
     }
     else
     {
         base.InitializeDataCell(cell, rowState);
     }
 }
        public override void ExtractValuesFromCell(IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
        {
            if ((ReadOnly && !includeReadOnly) || cell.Controls.Count == 0)
            {
                return;
            }

            bool editable = (rowState & (DataControlRowState.Edit | DataControlRowState.Insert)) != 0;

            if (includeReadOnly || editable)
            {
                Control control = cell.Controls [0];
                //TODO: other controls?
                if (control is Image)
                {
                    dictionary [DataImageUrlField] = ((Image)control).ImageUrl;
                }
                else if (control is TextBox)
                {
                    dictionary [DataImageUrlField] = ((TextBox)control).Text;
                }
            }
        }
예제 #50
0
        /// <devdoc>
        ///    <para>
        ///       Initializes the cell representing this field with the
        ///       contained hyperlink.</para>
        /// </devdoc>
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            base.InitializeCell(cell, cellType, rowState, rowIndex);

            if (cellType == DataControlCellType.DataCell)
            {
                HyperLink hyperLink = new HyperLink();

                hyperLink.Text        = Text;
                hyperLink.NavigateUrl = NavigateUrl;
                hyperLink.Target      = Target;

                if (((rowState & DataControlRowState.Insert) == 0) && Visible)
                {
                    if ((DataNavigateUrlFields.Length != 0) ||
                        (DataTextField.Length != 0))
                    {
                        hyperLink.DataBinding += new EventHandler(this.OnDataBindField);
                    }

                    cell.Controls.Add(hyperLink);
                }
            }
        }
예제 #51
0
        private void AddButtonToCell(DataControlFieldCell cell, string commandName, string buttonText, bool causesValidation, string validationGroup, int rowIndex, string imageUrl)
        {
            IButtonControl     button;
            IPostBackContainer container = Control as IPostBackContainer;
            bool setCausesValidation     = true; // the setter on the DataControlButtons throw if there's a container for security

            switch (ButtonType)
            {
            case ButtonType.Link: {
                if (container != null && !causesValidation)
                {
                    button = new DataControlLinkButton(container);
                    setCausesValidation = false;
                }
                else
                {
                    button = new DataControlLinkButton(null);
                }

                break;
            }

            case ButtonType.Button: {
                if (container != null && !causesValidation)
                {
                    button = new DataControlButton(container);
                    setCausesValidation = false;
                }
                else
                {
                    button = new Button();
                }

                break;
            }

            case ButtonType.Image:
            default: {
                if (container != null && !causesValidation)
                {
                    button = new DataControlImageButton(container);
                    setCausesValidation = false;
                }
                else
                {
                    button = new ImageButton();
                }

                ((ImageButton)button).ImageUrl = imageUrl;
                break;
            }
            }

            button.Text            = buttonText;
            button.CommandName     = commandName;
            button.CommandArgument = rowIndex.ToString(CultureInfo.InvariantCulture);
            if (setCausesValidation)
            {
                button.CausesValidation = causesValidation;
            }
            button.ValidationGroup = validationGroup;

            cell.Controls.Add((WebControl)button);
        }
 protected virtual new void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
 {
     Contract.Requires(cell != null);
 }
예제 #53
0
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            base.InitializeCell(cell, cellType, rowState, rowIndex);
            if ((cellType != DataControlCellType.Header) && (cellType != DataControlCellType.Footer))
            {
                IButtonControl     control;
                IPostBackContainer container = base.Control as IPostBackContainer;
                bool causesValidation        = this.CausesValidation;
                bool flag2 = true;
                switch (this.ButtonType)
                {
                case ButtonType.Button:
                    if ((container == null) || causesValidation)
                    {
                        control = new Button();
                    }
                    else
                    {
                        control = new DataControlButton(container);
                        flag2   = false;
                    }
                    break;

                case ButtonType.Link:
                    if ((container == null) || causesValidation)
                    {
                        control = new DataControlLinkButton(null);
                    }
                    else
                    {
                        control = new DataControlLinkButton(container);
                        flag2   = false;
                    }
                    break;

                default:
                    if ((container != null) && !causesValidation)
                    {
                        control = new DataControlImageButton(container);
                        flag2   = false;
                    }
                    else
                    {
                        control = new ImageButton();
                    }
                    ((ImageButton)control).ImageUrl = this.ImageUrl;
                    break;
                }
                control.Text            = this.Text;
                control.CommandName     = this.CommandName;
                control.CommandArgument = rowIndex.ToString(CultureInfo.InvariantCulture);
                if (flag2)
                {
                    control.CausesValidation = causesValidation;
                }
                control.ValidationGroup = this.ValidationGroup;
                if ((this.DataTextField.Length != 0) && base.Visible)
                {
                    ((WebControl)control).DataBinding += new EventHandler(this.OnDataBindField);
                }
                cell.Controls.Add((WebControl)control);
            }
        }
예제 #54
0
 public virtual new void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
 }
 public override void ExtractValuesFromCell(System.Collections.Specialized.IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
 {
 }
 public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
 }
 protected virtual new void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
 {
 }
예제 #58
0
        /// <devdoc>
        ///    <para>Initializes a cell within the field.</para>
        /// </devdoc>
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            base.InitializeCell(cell, cellType, rowState, rowIndex);
            bool           showEditButton   = ShowEditButton;
            bool           showDeleteButton = ShowDeleteButton;
            bool           showInsertButton = ShowInsertButton;
            bool           showSelectButton = ShowSelectButton;
            bool           showCancelButton = ShowCancelButton;
            bool           isFirstButton    = true;
            bool           causesValidation = CausesValidation;
            string         validationGroup  = ValidationGroup;
            LiteralControl spaceControl;

            if (cellType == DataControlCellType.DataCell)
            {
                if ((rowState & (DataControlRowState.Edit | DataControlRowState.Insert)) != 0)
                {
                    if ((rowState & DataControlRowState.Edit) != 0 && showEditButton)
                    {
                        AddButtonToCell(cell, DataControlCommands.UpdateCommandName, UpdateText, causesValidation, validationGroup, rowIndex, UpdateImageUrl);
                        if (showCancelButton)
                        {
                            spaceControl = new LiteralControl("&nbsp;");
                            cell.Controls.Add(spaceControl);
                            AddButtonToCell(cell, DataControlCommands.CancelCommandName, CancelText, false, String.Empty, rowIndex, CancelImageUrl);
                        }
                    }
                    if ((rowState & DataControlRowState.Insert) != 0 && showInsertButton)
                    {
                        AddButtonToCell(cell, DataControlCommands.InsertCommandName, InsertText, causesValidation, validationGroup, rowIndex, InsertImageUrl);
                        if (showCancelButton)
                        {
                            spaceControl = new LiteralControl("&nbsp;");
                            cell.Controls.Add(spaceControl);
                            AddButtonToCell(cell, DataControlCommands.CancelCommandName, CancelText, false, String.Empty, rowIndex, CancelImageUrl);
                        }
                    }
                }
                else
                {
                    if (showEditButton)
                    {
                        AddButtonToCell(cell, DataControlCommands.EditCommandName, EditText, false, String.Empty, rowIndex, EditImageUrl);
                        isFirstButton = false;
                    }
                    if (showDeleteButton)
                    {
                        if (isFirstButton == false)
                        {
                            spaceControl = new LiteralControl("&nbsp;");
                            cell.Controls.Add(spaceControl);
                        }
                        AddButtonToCell(cell, DataControlCommands.DeleteCommandName, DeleteText, false, String.Empty, rowIndex, DeleteImageUrl);
                        isFirstButton = false;
                    }
                    if (showInsertButton)
                    {
                        if (isFirstButton == false)
                        {
                            spaceControl = new LiteralControl("&nbsp;");
                            cell.Controls.Add(spaceControl);
                        }
                        AddButtonToCell(cell, DataControlCommands.NewCommandName, NewText, false, String.Empty, rowIndex, NewImageUrl);
                        isFirstButton = false;
                    }
                    if (showSelectButton)
                    {
                        if (isFirstButton == false)
                        {
                            spaceControl = new LiteralControl("&nbsp;");
                            cell.Controls.Add(spaceControl);
                        }
                        AddButtonToCell(cell, DataControlCommands.SelectCommandName, SelectText, false, String.Empty, rowIndex, SelectImageUrl);
                        isFirstButton = false;
                    }
                }
            }
        }
 protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
 {
 }
        /// <devdoc>
        /// Extracts the value(s) from the given cell and puts the value(s) into a dictionary.  Indicate includeReadOnly
        /// to have readonly fields' values inserted into the dictionary.
        /// </devdoc>
        public override void ExtractValuesFromCell(IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
        {
            Control childControl    = null;
            string  dataField       = DataField;
            object  value           = null;
            string  nullDisplayText = NullDisplayText;

            if (((rowState & DataControlRowState.Insert) != 0) && !InsertVisible)
            {
                return;
            }

            if (cell.Controls.Count > 0)
            {
                childControl = cell.Controls[0];

                TextBox editBox = childControl as TextBox;
                if (editBox != null)
                {
                    value = editBox.Text;
                }
            }
            else
            {
                if (includeReadOnly == true)
                {
                    string cellText = cell.Text;
                    if (cellText == "&nbsp;")   // nothing HtmlEncodes to &nbsp;, so we know that this means it was empty.
                    {
                        value = String.Empty;
                    }
                    else
                    {
                        if (SupportsHtmlEncode && HtmlEncode)
                        {
                            value = HttpUtility.HtmlDecode(cellText);
                        }
                        else
                        {
                            value = cellText;
                        }
                    }
                }
            }

            if (value != null)
            {
                if ((value is string) && (((string)value).Length == 0) && ConvertEmptyStringToNull)
                {
                    value = null;
                }

                if (value is string && (string)value == nullDisplayText && nullDisplayText.Length > 0)
                {
                    value = null;
                }

                if (dictionary.Contains(dataField))
                {
                    dictionary[dataField] = value;
                }
                else
                {
                    dictionary.Add(dataField, value);
                }
            }
        }