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);
     }
 }
示例#2
0
        protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
        {
            Control ctrl = null;

            if (this.EditMode || this.InsertMode)
            {
                HtmlEditor control = this.CreateControl();
                this.CopyProperties(control);
                control.Init += OnControlInit;
                if (!base.Visible)
                {
                    control.Required = false;
                }
                if (cell != null)
                {
                    cell.Controls.Add(control);
                }
                ctrl = control;
            }
            else
            {
                if (cell != null)
                {
                    cell.Style[HtmlTextWriterStyle.PaddingLeft] = "3px";
                }
                ctrl = cell;
            }

            if (ctrl != null && base.Visible)
            {
                ctrl.DataBinding += new EventHandler(this.OnBindingField);
            }
        }
    public override void ExtractValuesFromCell(IOrderedDictionary dictionary, DataControlFieldCell cell,
                                               DataControlRowState rowState, bool includeReadOnly)
    {
        string dataField = DataField;
        object obj2      = null;

        // object obj3 = null;
        if (cell.Controls.Count > 0)
        {
            // Get column editor of type DropDownList of current cell
            Control      control      = cell.Controls[0];
            DropDownList dropDownList = control as DropDownList;
            if ((dropDownList != null) && (includeReadOnly || dropDownList.Enabled))
            {
                obj2 = dropDownList.Text;
            }
        }
        if (obj2 != null)
        {
            if (dictionary.Contains(dataField))
            {
                dictionary[dataField] = obj2;
            }
            else
            {
                //put both text and value into the dictionary
                dictionary.Add(dataField, obj2);
            }
        }
    }
示例#4
0
        protected virtual void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
        {
            Control child    = null;
            Control control2 = null;

            if ((((rowState & DataControlRowState.Edit) != DataControlRowState.Normal) && !this.ReadOnly) || ((rowState & DataControlRowState.Insert) != DataControlRowState.Normal))
            {
                TextBox box = new TextBox {
                    ToolTip = this.HeaderText
                };
                child = box;
                if ((this.DataField.Length != 0) && ((rowState & DataControlRowState.Edit) != DataControlRowState.Normal))
                {
                    control2 = box;
                }
            }
            else if (this.DataField.Length != 0)
            {
                control2 = cell;
            }
            if (child != null)
            {
                cell.Controls.Add(child);
            }
            if ((control2 != null) && base.Visible)
            {
                control2.DataBinding += new EventHandler(this.OnDataBindField);
            }
        }
示例#5
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);
            }
        }
示例#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);
 }
		public GridViewRow (int rowIndex, int dataItemIndex, DataControlRowType rowType, DataControlRowState rowState)
		{
			this.rowIndex = rowIndex;
			this.dataItemIndex = dataItemIndex;
			this.rowType = rowType;
			this.rowState = rowState;
		}
示例#8
0
        protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
        {
            DropDownList control = new DropDownList();

            this.CopyProperties(control);
            control.Init += OnControlInit;

            if (!(this.EditMode || this.InsertMode))
            {
                control.Enabled = false;
            }

            if (base.Visible)
            {
                control.DataBinding += new EventHandler(this.OnBindingField);
                if (this.SelectedIndexChanged != null)
                {
                    control.SelectedIndexChanged += this.SelectedIndexChanged;
                }
            }

            cell.Controls.Add(new LiteralControl("   "));
            cell.Controls.Add(control);
            cell.Style.Add(HtmlTextWriterStyle.PaddingLeft, "11px");
        }
示例#9
0
        protected void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
        {
            var label = new Label();

            label.DataBinding += new EventHandler(Label_DataBinding);
            cell.Controls.Add(label);
        }
示例#10
0
        /// <summary>
        /// Initializes the specified System.Web.UI.WebControls.TableCell object to the specified row state.
        /// </summary>
        /// <param name="cell">The System.Web.UI.WebControls.TableCell to initialize.</param>
        /// <param name="rowState">One of the System.Web.UI.WebControls.DataControlRowState values.</param>
        protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
        {
            CheckBox control = new CheckBox();

            CopyProperties(control);
            control.Init += OnControlInit;

            if (this.InsertMode)
            {
                control.Checked = DefaultChecked;
            }
            else if (!this.EditMode)
            {
                control.Enabled = control.Required = false;
            }

            if (base.Visible)
            {
                if (!this.InsertMode)
                {
                    control.DataBinding += new EventHandler(this.OnBindingField);
                }
            }
            else
            {
                control.Required = false;
            }

            if (cell != null)
            {
                cell.Controls.Add(control);
            }
        }
    protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
    {
        Control cellControl = null;

        if ((((rowState & DataControlRowState.Edit) != DataControlRowState.Normal) && !this.ReadOnly) ||
            ((rowState & DataControlRowState.Insert) != DataControlRowState.Normal))
        {
            // If data cell is in edit mode, create DropDownList editor for this cell
            // and set data properties.
            DropDownList dropDownList = new DropDownList();
            dropDownList.AppendDataBoundItems = true;
            dropDownList.Items.Add(DefaultValueText);
            dropDownList.DataSource     = this.GetDataSource();
            dropDownList.DataMember     = this.BusinessObjectName;
            dropDownList.DataTextField  = this.DataTextField;
            dropDownList.DataValueField = this.DataValueField;
            dropDownList.ToolTip        = this.HeaderText;
            cell.Controls.Add(dropDownList);
            //dropDownList.DataBind();

            // if in edit mode, prepare dropdown for binding
            if ((this.DataField.Length != 0) && ((rowState & DataControlRowState.Edit) != DataControlRowState.Normal))
            {
                dropDownList.DataBound += new EventHandler(this.OnDataBound);     // attach to event for item selection
            }
        }
        //else if (this.DataField.Length != 0)    // if in read only mode, prepare cell for binding
        //{
        //    cellControl = cell;
        //}
        //if ((cellControl != null) && base.Visible)
        //{
        //    cellControl.DataBinding += new EventHandler(this.OnDataBindField);
        //}
    }
示例#12
0
        public override void InitializeCell(DataControlFieldCell cell,
                                            DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            string index = rowIndex.ToString();

            if (cellType == DataControlCellType.DataCell)
            {
                if ((rowState & DataControlRowState.Edit) != 0)
                {
                    if (ShowEditButton)
                    {
                        cell.Controls.Add(CreateButton(UpdateText, UpdateImageUrl, DataControlCommands.UpdateCommandName, index));
                        if (ShowCancelButton)
                        {
                            AddSeparator(cell);
                            cell.Controls.Add(CreateButton(CancelText, CancelImageUrl, DataControlCommands.CancelCommandName, index));
                        }
                    }
                }
                else if ((rowState & DataControlRowState.Insert) != 0)
                {
                    if (ShowInsertButton)
                    {
                        cell.Controls.Add(CreateButton(InsertText, InsertImageUrl, DataControlCommands.InsertCommandName, index));
                        if (ShowCancelButton)
                        {
                            AddSeparator(cell);
                            cell.Controls.Add(CreateButton(CancelText, CancelImageUrl, DataControlCommands.CancelCommandName, index));
                        }
                    }
                }
                else
                {
                    if (ShowEditButton)
                    {
                        AddSeparator(cell);
                        cell.Controls.Add(CreateButton(EditText, EditImageUrl, DataControlCommands.EditCommandName, index));
                    }
                    if (ShowDeleteButton)
                    {
                        AddSeparator(cell);
                        cell.Controls.Add(CreateButton(DeleteText, DeleteImageUrl, DataControlCommands.DeleteCommandName, index));
                    }
                    if (ShowInsertButton)
                    {
                        AddSeparator(cell);
                        cell.Controls.Add(CreateButton(NewText, NewImageUrl, DataControlCommands.NewCommandName, index));
                    }
                    if (ShowSelectButton)
                    {
                        AddSeparator(cell);
                        cell.Controls.Add(CreateButton(SelectText, SelectImageUrl, DataControlCommands.SelectCommandName, index));
                    }
                }
            }
            else
            {
                base.InitializeCell(cell, cellType, rowState, rowIndex);
            }
        }
示例#13
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);
        }
示例#14
0
        protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
        {
            TimDateTime dtEdit = new TimDateTime();

            dtEdit.ID = "dt" + this.DataField;
            bool flag = base.Visible && base.ItemStyle.Width.Value > 2.0;

            if (flag)
            {
                dtEdit.Width = new Unit(base.ItemStyle.Width.Value - 2.0);
            }
            else
            {
                dtEdit.Width = base.ItemStyle.Width;
            }
            dtEdit.Enabled = this.Enabled;
            bool flag2 = this.TextChanged != null;

            if (flag2)
            {
                dtEdit.AutoPostBack = true;
                dtEdit.TextChanged += new EventHandler(this.TextChanged.Invoke);
            }
            dtEdit.DataBinding += new EventHandler(this.Edit_DataBinding);
            cell.Controls.Add(dtEdit);
        }
 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);
         }
     }
 }
示例#16
0
        protected virtual void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
        {
            Control boundControl = null;

            if (((rowState & DataControlRowState.Edit) != 0 && ReadOnly == false) || (rowState & DataControlRowState.Insert) != 0)
            {
                TextBox editor = new TextBox();
                cell.Controls.Add(editor);

                if (DataImageUrlField.Length != 0 && (rowState & DataControlRowState.Edit) != 0)
                {
                    boundControl = editor;
                }
            }
            else if (DataImageUrlField.Length != 0)
            {
                boundControl = cell;
                Image image = new Image();
                Label label = new Label();
                cell.Controls.Add(image);
                cell.Controls.Add(label);
            }

            if (boundControl != null && Visible)
            {
                boundControl.DataBinding += new EventHandler(this.OnDataBindField);
            }
        }
 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);
     }
 }
示例#18
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);
     }
 }
示例#19
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);
        }
示例#20
0
            /// <summary>
            /// Adds a new instance of controlBase (a CaisisInputControl) to the row's cell
            /// </summary>
            /// <param name="cell"></param>
            /// <param name="rowState"></param>
            protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
            {
                ICaisisInputControl iCIC = new CaisisTextBox();

                if (BaseCaisisInputControl == null)
                {
                    if (!string.IsNullOrEmpty(CaisisControlTypeName))
                    {
                        //// Create Control, set Field, then set MetaData values
                        //iCIC = CICHelper.InvokeInputControl(CaisisControlTypeName);
                        //iCIC.Field = cicFieldName;
                        //CICHelper.SetCICAttributes(iCIC, CaisisControlMetaTable);
                    }
                }
                else
                {
                    iCIC = CICHelper.CloneCIC(controlBase);
                }
                // Supress FieldLabel
                iCIC.ShowLabel = false;

                // handle binding
                BindControl(this, new CaisisControlEventArgs(iCIC));

                // Add control to cell
                cell.Controls.Add(iCIC as Control);
            }
示例#21
0
 public virtual void InitializeCell(DataControlFieldCell cell,
                                    DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
     if (cellType == DataControlCellType.Header)
     {
         if (HeaderText.Length > 0 && sortingEnabled && SortExpression.Length > 0)
         {
             cell.Controls.Add((Control)DataControlButton.CreateButton(String.IsNullOrEmpty(HeaderImageUrl) ? ButtonType.Link : ButtonType.Image, control, HeaderText, HeaderImageUrl, DataControlCommands.SortCommandName, SortExpression, true));
         }
         else if (HeaderImageUrl.Length > 0)
         {
             Image image = new Image();
             image.ImageUrl = HeaderImageUrl;
             cell.Controls.Add(image);
         }
         else
         {
             cell.Text = HeaderText.Length > 0 ? HeaderText : "&nbsp;";
         }
     }
     else if (cellType == DataControlCellType.Footer)
     {
         string footerText = FooterText;
         cell.Text = (footerText.Length > 0) ? footerText : "&nbsp;";
     }
 }
示例#22
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);
               }
        }
        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);
            }
        }
示例#24
0
        // This method adds a RadioButton control and any other
        // content to the cell's Controls collection.
        protected override void InitializeDataCell
            (DataControlFieldCell cell, DataControlRowState rowState)
        {
            RadioButton radio = new RadioButton();

            // If the RadioButton is bound to a DataField, add
            // the OnDataBindingField method event handler to the
            // DataBinding event.
            if (DataField.Length != 0)
            {
                radio.DataBinding += new EventHandler(this.OnDataBindField);
            }

            radio.Text = this.Text;

            // Because the RadioButtonField is a BoundField, it only
            // displays data. Therefore, unless the row is in edit mode,
            // the RadioButton is displayed as disabled.
            radio.Enabled = false;
            // If the row is in edit mode, enable the button.
            if ((rowState & DataControlRowState.Edit) != 0 ||
                (rowState & DataControlRowState.Insert) != 0)
            {
                radio.Enabled = true;
            }

            cell.Controls.Add(radio);
        }
示例#25
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);
        }
示例#26
0
        public override void ExtractValuesFromCell(IOrderedDictionary dictionary,
                                                   DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
        {
            IBindableTemplate bt;

            if ((rowState & DataControlRowState.Insert) != 0)
            {
                bt = insertItemTemplate as IBindableTemplate;
            }
            else if ((rowState & DataControlRowState.Edit) != 0)
            {
                bt = editItemTemplate as IBindableTemplate;
            }
            else if (alternatingItemTemplate != null && (rowState & DataControlRowState.Alternate) != 0)
            {
                bt = alternatingItemTemplate as IBindableTemplate;
            }
            else
            {
                bt = itemTemplate as IBindableTemplate;
            }

            if (bt != null)
            {
                IOrderedDictionary values = bt.ExtractValues(cell);
                if (values == null)
                {
                    return;
                }
                foreach (DictionaryEntry e in values)
                {
                    dictionary [e.Key] = e.Value;
                }
            }
        }
        protected virtual void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
        {
            Control control = null;

            if ((((rowState & DataControlRowState.Edit) != DataControlRowState.Normal) && !this.ReadOnly) || ((rowState & DataControlRowState.Insert) != DataControlRowState.Normal))
            {
                TextBox child = new TextBox();
                cell.Controls.Add(child);
                if ((this.DataImageUrlField.Length != 0) && ((rowState & DataControlRowState.Edit) != DataControlRowState.Normal))
                {
                    control = child;
                }
            }
            else if (this.DataImageUrlField.Length != 0)
            {
                control = cell;
                Image image = new Image();
                Label label = new Label();
                cell.Controls.Add(image);
                cell.Controls.Add(label);
            }
            if ((control != null) && base.Visible)
            {
                control.DataBinding += new EventHandler(this.OnDataBindField);
            }
        }
示例#28
0
        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;
                }
            }
        }
 public FormViewRow(int itemIndex, DataControlRowType rowType, DataControlRowState rowState)
 {
     this._itemIndex = itemIndex;
     this._rowType   = rowType;
     this._rowState  = rowState;
     this.RenderTemplateContainer = true;
 }
        protected virtual void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
        {
            Control childControl = null;
            Control boundControl = null;

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

                if (DataField.Length != 0 && (rowState & DataControlRowState.Edit) != 0)
                {
                    boundControl = editor;
                }
            }
            else if (DataField.Length != 0)
            {
                boundControl = cell;
            }

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

            if (boundControl != null && Visible)
            {
                boundControl.DataBinding += new EventHandler(this.OnDataBindField);
            }
        }
示例#31
0
        protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
        {
            TimNumericTextBox ntEdit = new TimNumericTextBox();

            ntEdit.ID = "nt" + this.DataField;
            bool flag = base.Visible && base.ItemStyle.Width.Value > 2.0;

            if (flag)
            {
                ntEdit.Width = new Unit(base.ItemStyle.Width.Value - 2.0);
            }
            else
            {
                ntEdit.Width = base.ItemStyle.Width;
            }
            ntEdit.Enabled       = this.Enabled;
            ntEdit.Min           = this.Min;
            ntEdit.Max           = this.Max;
            ntEdit.DecimalPlaces = this.DecimalPlaces;
            ntEdit.ShowZero      = this.ShowZero;
            bool flag2 = this.TextChanged != null;

            if (flag2)
            {
                ntEdit.AutoPostBack = true;
                ntEdit.TextChanged += new EventHandler(this.TextChanged.Invoke);
            }
            ntEdit.DataBinding += new EventHandler(this.txtEdit_DataBinding);
            cell.Controls.Add(ntEdit);
        }
 public GridViewRow(int rowIndex, int dataItemIndex, DataControlRowType rowType, DataControlRowState rowState)
 {
     this.rowIndex      = rowIndex;
     this.dataItemIndex = dataItemIndex;
     this.rowType       = rowType;
     this.rowState      = rowState;
 }
 /// <summary>
 /// 构造函数
 /// </summary>
 public GridViewTableCell(TableCell tableCell, int columnIndex, DataControlRowType rowType, DataControlRowState rowState)
 {
     this._tableCell = tableCell;
     this._columnIndex = columnIndex;
     this._rowType = rowType;
     this._rowState = rowState;
 }
示例#34
0
        protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
        {
            this.CopyProperties(m_InnerControl);
            m_InnerControl.Init += OnControlInit;

            if (!(this.EditMode || this.InsertMode))
            {
                m_InnerControl.Enabled = m_InnerControl.Required = false;
            }

            if (base.Visible)
            {
                m_InnerControl.DataBinding += new EventHandler(this.OnBindingField);
                if (this.SelectedIndexChanged != null)
                {
                    m_InnerControl.SelectedIndexChanged += this.SelectedIndexChanged;
                }
            }
            else
            {
                m_InnerControl.Required = false;
            }

            if (cell != null)
            {
                cell.Controls.Add(m_InnerControl);
            }
        }
 public FormViewRow(int itemIndex, DataControlRowType rowType, DataControlRowState rowState)
 {
     this._itemIndex = itemIndex;
     this._rowType = rowType;
     this._rowState = rowState;
     this.RenderTemplateContainer = true;
 }
示例#36
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);
        }
示例#37
0
        /// <summary>
        /// Initializes the specified System.Web.UI.WebControls.TableCell object to the specified row state.
        /// </summary>
        /// <param name="cell">The System.Web.UI.WebControls.TableCell to initialize.</param>
        /// <param name="rowState">One of the System.Web.UI.WebControls.DataControlRowState values.</param>
        protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
        {
            if (base.DesignMode)
            {
                if (cell != null)
                {
                    cell.Text = (string)base.GetDesignTimeValue();
                }
                return;
            }

            RadioButtonList control = new RadioButtonList();

            CopyProperties(control);
            control.Init += OnControlInit;

            if (!(this.EditMode || this.InsertMode))
            {
                control.Enabled = control.Required = false;
            }

            if (base.Visible)
            {
                control.DataBinding += new EventHandler(this.OnBindingField);
            }
            else
            {
                control.Required = false;
            }

            if (cell != null)
            {
                cell.Controls.Add(control);
            }
        }
 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);
 }
		public DetailsViewPagerRow (
			int rowIndex,
			DataControlRowType rowType,
			DataControlRowState rowState
		)
			:base (rowIndex, rowType, rowState)
		{
		}
示例#40
0
 public DetailsViewPagerRow(
     int rowIndex,
     DataControlRowType rowType,
     DataControlRowState rowState
     )
     : base(rowIndex, rowType, rowState)
 {
 }
示例#41
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);
        }
示例#42
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);
		}
示例#43
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);
			}
示例#44
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));
            }
        }
 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);
 }
 public override void ExtractValuesFromCell(IOrderedDictionary dictionary, DataControlFieldCell cell,
     DataControlRowState rowState, bool includeReadOnly)
 {
     Control control = null;
     string dataField = DataField;
     object text = null;
     string nullDisplayText = NullDisplayText;
     if (((rowState & DataControlRowState.Insert) == DataControlRowState.Normal) || InsertVisible)
     {
         if (cell.Controls.Count > 0)
         {
             control = cell.Controls[0];
             DropDownList box = control as DropDownList;
             if (box != null)
             {
                 text = box.SelectedValue;
             }
         }
         else if (includeReadOnly)
         {
             string s = cell.Text;
             if (s == "&nbsp;")
             {
                 text = string.Empty;
             }
             else if (SupportsHtmlEncode && HtmlEncode)
             {
                 text = HttpUtility.HtmlDecode(s);
             }
             else
             {
                 text = s;
             }
         }
         if (text != null)
         {
             if (((text is string) && (((string)text).Length == 0)) && 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);
             }
         }
     }
 }
示例#47
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);
        }
示例#48
0
        protected virtual void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
        {
            bool editable = IsEditable(rowState);

            if (editable)
            {
                TextBox box = new TextBox();
                cell.Controls.Add(box);
                box.ToolTip = HeaderText;
            }
        }
 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);
 }
示例#50
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);
            }
        }
示例#51
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);
            }
        }
示例#52
0
        public override void ExtractValuesFromCell(IOrderedDictionary dictionary,
                                                   DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
        {
            bool editable = IsEditable(rowState);

            if (editable || includeReadOnly)
            {
                CheckBox box = (CheckBox)cell.Controls [0];
                dictionary [DataField] = box.Checked;
            }
        }
 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);
             }
         }
     }
 }
 protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
 {
     base.InitializeDataCell(cell, rowState);
     if (cell.Controls.Count == 0)
     {
         CheckBox child = new CheckBox {
             ID = "CheckBoxButton"
         };
         cell.Controls.Add(child);
     }
 }
示例#55
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);
     }
 }
示例#56
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);
		}
示例#57
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;
            }
        }
示例#58
0
文件: TestButton.cs 项目: NLADP/ADF
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            base.InitializeCell(cell, cellType, rowState, rowIndex);

            if (cellType == DataControlCellType.DataCell)
            {
                var testButtonItemTemplate = new TestButtonItemTemplate(DataField);

                testButtonItemTemplate.DataBinding += (sender, args) => DataBinding.Invoke(this, args);

                ItemTemplate = testButtonItemTemplate;
            }
        }
示例#59
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);
            }
        }
示例#60
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 );
        }