Exemple #1
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);
        }
Exemple #2
0
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            CheckBox box;

            base.InitializeCell(cell, cellType, rowState, rowIndex);
            if (cellType == DataControlCellType.Header)
            {
                cell.Attributes.Add("class", "colSelect");
                box = new CheckBox {
                    ID = "chkSelect"
                };
                cell.Controls.Add(box);
            }
            else if (cellType == DataControlCellType.DataCell)
            {
                cell.Attributes.Add("class", "colSelect");
                box = new CheckBox {
                    ID = "chkSelect"
                };
                cell.Controls.Add(box);
                string str = ((MyGridView)base.Control).DataKeys[rowIndex].Value.ToString();
                cell.Attributes.Add("SelectID", str);
                string alreadySelectedRowKeys = ((MyGridView)base.Control).AlreadySelectedRowKeys;
                if (alreadySelectedRowKeys.IsNoNull())
                {
                    box.Checked = alreadySelectedRowKeys.ConvertListString().IndexOf(str) != -1;
                }
            }
            else if (cellType == DataControlCellType.Footer)
            {
                cell.Text = "合计";
            }
        }
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            base.EditImageUrl   = this.EditImageUrl;
            base.UpdateImageUrl = this.UpdateImageUrl;
            base.CancelImageUrl = this.CancelImageUrl;
            base.InsertImageUrl = this.InsertImageUrl;

            if (ShowAddButton)
            { //reuse the insert button
                base.ShowInsertButton = true;
                base.InsertImageUrl   = this.AddImageUrl;
                this._commandTag      = "Add";
            }

            if (ShowEditButton)
            {
                base.ShowEditButton = true;
                base.EditImageUrl   = this.EditImageUrl;
                this._commandTag    = "Edit";
            }

            if (ShowCancelButton)
            {
                base.ShowCancelButton = true;
                base.CancelImageUrl   = this.CancelImageUrl;
                this._commandTag      = "Cancel";
            }

            if (ShowUpdateButton)
            {
                base.UpdateImageUrl = this.UpdateImageUrl;
                this._commandTag    = "Update";
            }

            if (isImageButton)
            { //reuse the select button
                base.ShowSelectButton = true;
                base.SelectImageUrl   = this.ImageButtonURL;
                this._commandTag      = "Image";
            }

            if (isExpandingButton)
            { //reuse the select button
                base.ShowSelectButton = true;
                base.SelectImageUrl   = this.ImageButtonURL;
                this._commandTag      = "Expand";
            }

            if (ShowNewButton)
            { //reuse the select button
                base.ShowSelectButton = true;
                base.SelectImageUrl   = this.NewImageUrl;
                this._commandTag      = "New";
            }

            base.ItemStyle.CssClass       = this.ControlStyle.CssClass;
            base.ItemStyle.Width          = this.ItemStyle.Width;
            base.ControlStyle.BorderWidth = Unit.Pixel(0);
            base.InitializeCell(cell, cellType, rowState, rowIndex);
        }
        /// <devdoc>
        /// <para>Initializes a cell in the DataControlField.</para>
        /// </devdoc>
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            string unencodedHeaderText = null;
            bool   changedHeaderText   = false;
            bool   encode = false;

            // if this is a header cell and we're htmlEncoding, htmlEncode the HeaderText before the base class tries to render it
            if (cellType == DataControlCellType.Header && SupportsHtmlEncode && HtmlEncode)
            {
                unencodedHeaderText = HeaderText;
                encode = true;
            }

            if (encode && !String.IsNullOrEmpty(unencodedHeaderText))
            {
                _suppressHeaderTextFieldChange = true;
                HeaderText        = HttpUtility.HtmlEncode(unencodedHeaderText);
                changedHeaderText = true;
            }
            base.InitializeCell(cell, cellType, rowState, rowIndex);

            // restore the HeaderText property
            if (changedHeaderText)
            {
                HeaderText = unencodedHeaderText;
                _suppressHeaderTextFieldChange = false;
            }
            switch (cellType)
            {
            case DataControlCellType.DataCell:
                InitializeDataCell(cell, rowState);
                break;
            }
        }
Exemple #5
0
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            if (cell == null)
            {
                return;
            }

            if (this.Control is MagicForm)
            {
                cell.CssClass = "Mf_H";
                if (this.Theme == MasterPageTheme.Modern)
                {
                    HtmlGenericControl div = new HtmlGenericControl("div");
                    div.InnerHtml = this.Text;

                    cell.Controls.Add(div);
                }
                else
                if (cellType == DataControlCellType.DataCell)
                {
                    cell.Text = Text;
                }
            }
            else
            if (cellType == DataControlCellType.DataCell)
            {
                cell.Text = Text;
            }

            BaseValidatedField.InitializeSpannedCell(cell, cellType);

            base.InitializeCell(cell, cellType, rowState, rowIndex);
        }
Exemple #6
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);
               }
        }
Exemple #7
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;";
     }
 }
Exemple #8
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);
        }
 public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
     base.InitializeCell(cell, cellType, rowState, rowIndex);
     
     if (cellType == DataControlCellType.Header)
     {
         var lb = new LinkButton
         {
             Text = HeaderText,
             ToolTip = String.IsNullOrWhiteSpace(HeaderToolTip) ? HeaderText : HeaderToolTip,
             CommandName = "Sort",
             CommandArgument = DataField
         };
         
         var tt = cell.Controls;
         cell.Controls.Add(lb);
         if (!String.IsNullOrWhiteSpace(SearchType))
         {
             // Add filter control
             var ctrlFilter = Control.Page.LoadControl("~/Controls/GridViewFilter.ascx") as GridViewFilter;
             cell.Controls.Add(ctrlFilter);
             ctrlFilter.ID = GridViewID + DataField;
             ctrlFilter.ColumnName = DataField;
             ctrlFilter.AssociatedControlType = SearchType;
             ctrlFilter.FilterApplied += ctrlFilter_FilterApplied;
         }
     }
     else if (cellType == DataControlCellType.DataCell)
         cell.DataBinding += new EventHandler(cell_DataBinding);
 }
Exemple #10
0
 public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
     base.InitializeCell(cell, cellType, rowState, rowIndex);
     if (!string.IsNullOrWhiteSpace(this.StatField))
     {
         if (cellType == DataControlCellType.DataCell)
         {
             cell.DataBinding += new EventHandler(this.cell_DataBinding);
         }
         else if (cellType == DataControlCellType.Header)
         {
             cell.Text = this.HeaderText;
         }
         else if (cellType == DataControlCellType.Footer)
         {
             double num = 0.0;
             foreach (DataControlFieldCell cell2 in this.objDataControlFieldCellList)
             {
                 num += Convert.ToDouble(cell2.Text);
             }
             if (num != 0.0)
             {
                 foreach (DataControlFieldCell cell2 in this.objDataControlFieldCellList)
                 {
                     cell2.Text = string.Format("{0:F}", (Convert.ToDouble(cell2.Text) / num) * 100.0) + "%";
                 }
             }
         }
     }
 }
Exemple #11
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");
            }
            string      webResourceUrl = base.Control.Page.ClientScript.GetWebResourceUrl(base.GetType(), "ASPNET.WebControls.Grid.Images.up.gif");
            string      str2           = base.Control.Page.ClientScript.GetWebResourceUrl(base.GetType(), "ASPNET.WebControls.Grid.Images.down.gif");
            ImageButton child          = new ImageButton {
                ID          = "rise",
                ImageUrl    = webResourceUrl,
                CommandName = "Rise"
            };
            ImageButton button2 = new ImageButton {
                ID          = "fall",
                ImageUrl    = str2,
                CommandName = "Fall"
            };

            if (cellType == DataControlCellType.DataCell)
            {
                cell.Controls.Add(button2);
                cell.Controls.Add(child);
            }
        }
Exemple #12
0
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            string headerText = null;
            bool   flag       = false;
            bool   flag2      = false;

            if (((cellType == DataControlCellType.Header) && this.SupportsHtmlEncode) && this.HtmlEncode)
            {
                headerText = this.HeaderText;
                flag2      = true;
            }
            if (flag2 && !string.IsNullOrEmpty(headerText))
            {
                this._suppressHeaderTextFieldChange = true;
                this.HeaderText = HttpUtility.HtmlEncode(headerText);
                flag            = true;
            }
            base.InitializeCell(cell, cellType, rowState, rowIndex);
            if (flag)
            {
                this.HeaderText = headerText;
                this._suppressHeaderTextFieldChange = false;
            }
            if (cellType == DataControlCellType.DataCell)
            {
                this.InitializeDataCell(cell, rowState);
            }
        }
Exemple #13
0
        protected override void InitializeControls(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            image = new Image();
            image.SetId(ChildId);

            cell.Controls.Add(image);
        }
Exemple #14
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);
            }
        }
Exemple #15
0
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            cell.Attributes.Add("class", "colRadioSelect");
            base.InitializeCell(cell, cellType, rowState, rowIndex);
            switch (cellType)
            {
            case DataControlCellType.Header:
            {
                Literal child = new Literal {
                    Text = "单选"
                };
                cell.Controls.Add(child);
                break;
            }

            case DataControlCellType.DataCell:
            {
                RadioButton button = new RadioButton {
                    ID = "chkSelect"
                };
                string str = ((MyGridView)base.Control).DataKeys[rowIndex].Value.ToString();
                cell.Attributes.Add("SelectID", str);
                string alreadySelectedRowKeys = ((MyGridView)base.Control).AlreadySelectedRowKeys;
                if (alreadySelectedRowKeys.IsNoNull())
                {
                    button.Checked = alreadySelectedRowKeys.ConvertListString().IndexOf(str) != -1;
                }
                cell.Controls.Add(button);
                break;
            }
            }
        }
Exemple #16
0
        /// <summary>
        /// Set up the data binding event handlers for each cell
        /// </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)
        {
            object obj = cell.Parent;

            switch (cellType)
            {
            case DataControlCellType.Header:
                // Assign sort icon and tooltip
                cell.DataBinding += new EventHandler(header_DataBinding);
                break;

            case DataControlCellType.DataCell:
                // Display data
                // Sharad 5 Oct 2010: Fixed bug. Earlier we were not executing this code if this.DataFields were null
                if ((rowState & DataControlRowState.Edit) == DataControlRowState.Edit)
                {
                    ITemplate templ = this.EditItemTemplate ?? new DefaultTemplate(this);
                    templ.InstantiateIn(cell);
                }
                else if ((rowState & DataControlRowState.Insert) == DataControlRowState.Insert)
                {
                    CreateInsertControls(cell);
                    //cell.DataBinding += new EventHandler(cellInsert_DataBinding);
                }
                else
                {
                    cell.DataBinding += new EventHandler(cell_DataBinding);
                    cell.PreRender   += new EventHandler(cell_PreRender);
                }
                break;
            }
            base.InitializeCell(cell, cellType, rowState, rowIndex);
        }
 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);
     }
 }
Exemple #18
0
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            string index = rowIndex.ToString();

            if (cellType == DataControlCellType.DataCell)
            {
                IDataControlButton btn = DataControlButton.CreateButton(ButtonType, Control, Text, ImageUrl, CommandName, index, false);

                if (CausesValidation)
                {
                    btn.Container        = null;
                    btn.CausesValidation = true;
                    btn.ValidationGroup  = ValidationGroup;
                }

                if (!String.IsNullOrEmpty(DataTextField))
                {
                    if ((rowState & DataControlRowState.Insert) == 0)
                    {
                        cell.DataBinding += new EventHandler(OnDataBindField);
                    }
                }
                cell.Controls.Add((Control)btn);
            }
            else
            {
                base.InitializeCell(cell, cellType, rowState, rowIndex);
            }
        }
Exemple #19
0
        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);
            }
        }
Exemple #20
0
        protected override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState)
        {
            if (cellType == DataControlCellType.DataCell)
            {
                string cmd      = Column.Params["cmd"];
                string cmdField = Column.Params["cmdField"];
                string cmdText  = Column.Params["cmdText"];

                string[] cmds = cmd.Split('|');
                isField    = !String.IsNullOrEmpty(cmdField);
                textfields = isField ? cmdField.Split('|') : cmdText.Split('|');

                for (int i = 0; i < cmds.Length; i++)
                {
                    if (i > 0)
                    {
                        Literal space = new Literal();
                        space.Text = "&nbsp;";
                        cell.Controls.Add(space);
                    }
                    if (regexcommand.IsMatch(cmds[i]))
                    {
                        InitHyperLink(cell, cmds[i], textfields[i]);
                    }
                    else
                    {
                        InitCommandButton(cell, cmds[i], textfields[i]);
                    }
                }
            }
        }
Exemple #21
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");
            }
            CheckBox checkBox = new CheckBox();

            switch (cellType)
            {
            case DataControlCellType.Header:
            {
                Label label = new Label();
                label.Text = this.text;
                label.ID   = "label";
                cell.Controls.Add(label);
                cell.Width = Unit.Pixel(this.HeadWidth);
                break;
            }

            case DataControlCellType.Footer:
                break;

            case DataControlCellType.DataCell:
                checkBox.ID = "checkboxCol";
                cell.Controls.Add(checkBox);
                cell.Width = Unit.Pixel(5);
                return;

            default:
                return;
            }
        }
Exemple #22
0
        /// <summary>
        /// Hooks up cell events depending on the state of the row
        /// </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)
        {
            switch (cellType)
            {
            case DataControlCellType.DataCell:
                // Secretly store the row index in cell text
                //cell.Text = rowIndex.ToString();
                if ((rowState & DataControlRowState.Edit) == DataControlRowState.Edit)
                {
                    cell.Init += new EventHandler(cellEdit_Init);
                }
                else if ((rowState & DataControlRowState.Insert) == DataControlRowState.Insert)
                {
                    cell.Init += new EventHandler(cellInsert_Init);
                }
                else
                {
                    cell.DataBinding += new EventHandler(cell_DataBinding);
                }
                break;

            case DataControlCellType.Footer:
                break;

            case DataControlCellType.Header:
                break;

            default:
                break;
            }
            base.InitializeCell(cell, cellType, rowState, rowIndex);
        }
Exemple #23
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");
            }
            string      webResourceUrl  = base.Control.Page.ClientScript.GetWebResourceUrl(base.GetType(), "ASPNET.WebControls.Grid.Images.up.gif");
            string      webResourceUrl2 = base.Control.Page.ClientScript.GetWebResourceUrl(base.GetType(), "ASPNET.WebControls.Grid.Images.down.gif");
            ImageButton imageButton     = new ImageButton();

            imageButton.ID          = "rise";
            imageButton.ImageUrl    = webResourceUrl;
            imageButton.CommandName = "Rise";
            ImageButton imageButton2 = new ImageButton();

            imageButton2.ID          = "fall";
            imageButton2.ImageUrl    = webResourceUrl2;
            imageButton2.CommandName = "Fall";
            if (cellType != DataControlCellType.DataCell)
            {
                return;
            }
            cell.Controls.Add(imageButton2);
            cell.Controls.Add(imageButton);
        }
Exemple #24
0
 public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
     base.InitializeCell(cell, cellType, rowState, rowIndex);
     if (cellType == DataControlCellType.DataCell)
     {
         cell.Attributes.Add("onclick", "return confirm(\"Are you sure you want to delete the item?\");");
     }
 }
 public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
     base.InitializeCell(cell, cellType, rowState, rowIndex);
     if (cellType == DataControlCellType.DataCell)
     {
         cell.Text = Convert.ToString(rowIndex + 1);
     }
 }
Exemple #26
0
 public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
     base.InitializeCell(cell, cellType, rowState, rowIndex);
     if (cellType == DataControlCellType.DataCell)
     {
         cell.Controls.Add(new TimeAgoControl());
     }
 }
 public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
     base.InitializeCell(cell, cellType, rowState, rowIndex);
     if (cellType == DataControlCellType.DataCell)
     {
         this.InitializeDataCell(cell, rowState);
     }
 }
Exemple #28
0
        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);
        }
Exemple #29
0
 protected override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState)
 {
     if (cellType == DataControlCellType.DataCell)
     {
         HyperLink lnk = new HyperLink();
         lnk.DataBinding += new EventHandler(lnk_DataBinding);
         cell.Controls.Add(lnk);
     }
 }
Exemple #30
0
 public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
     base.InitializeCell(cell, cellType, rowState, rowIndex);
     if (cellType == DataControlCellType.DataCell)
     {
         cell.DataBinding += new EventHandler(this.cell_DataBinding);
         this.InitializeDataCell(cell, rowState, rowIndex);
     }
 }
Exemple #31
0
 public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
     base.InitializeCell(cell, cellType, rowState, rowIndex);
     if ((((MyGridView)base.Control).OperateStyle == OperateStyle.RightOperate) && (cellType == DataControlCellType.DataCell))
     {
         cell.DataBinding += new EventHandler(this.cell_DataBinding);
         this.InitializeDataCell(cell, rowState, rowIndex);
     }
 }
Exemple #32
0
 protected override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState)
 {
     if (cellType == DataControlCellType.DataCell)
     {
         Literal ltl = new Literal();
         ltl.DataBinding += new EventHandler(ltl_DataBinding);
         cell.Controls.Add(ltl);
     }
 }
 public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
     base.InitializeCell(cell, cellType, rowState, rowIndex);
     if (cellType == DataControlCellType.DataCell)
     {
         WebControl button = (WebControl)cell.Controls[0];
         button.Attributes["onclick"] = String.Format("return confirm('{0}');", _ConfirmText);
     }
 }
Exemple #34
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));
            }
        }
Exemple #35
0
 public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
     base.InitializeCell(cell, cellType, rowState, rowIndex);
     if (cell != null)
     {
         if ((this.ColumnSpan > 1) && (cellType == DataControlCellType.DataCell))
         {
             cell.ColumnSpan = this.ColumnSpan;
         }
     }
 }
Exemple #36
0
 /// <summary>
 /// 格式化单元格
 /// </summary>
 /// <param name="cell"></param>
 /// <param name="cellType"></param>
 void InitCellStyle(DataControlFieldCell cell, DataControlCellType cellType)
 {
     cell.Width = Unit.Parse(Column.Params["lwidth"]);
     if (cellType == DataControlCellType.DataCell)
     {
         if (!String.IsNullOrEmpty(Column.Params["align"]))
         {
             cell.Style.Add(HtmlTextWriterStyle.TextAlign, Column.Params["align"]);
         }
     }
 }
Exemple #37
0
 public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
     base.InitializeCell(cell, cellType, rowState, rowIndex);
     if (cellType == DataControlCellType.DataCell)
     {
         cell.Controls.Clear();
         RadioButton rb = new RadioButton();
         rb.Enabled = !this.ReadOnly;
         cell.Controls.Add(rb);
     }
 }
Exemple #38
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);
        }
Exemple #39
0
        /// <devdoc>
        /// <para>Initializes a cell in the DataControlField.</para>
        /// </devdoc>
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            base.InitializeCell(cell, cellType, rowState, rowIndex);

            switch (cellType)
            {
            case DataControlCellType.DataCell:
                InitializeDataCell(cell, rowState);
                break;
            }
        }
 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);

            switch (cellType)
            {
                case DataControlCellType.DataCell:
                    cell.DataBinding += ItemDataBinding;
                    break;
            }
        }
Exemple #42
0
        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;
            }
        }
Exemple #43
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 );
        }
        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;";
            }
        }
Exemple #45
0
 public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
     base.InitializeCell(cell, cellType, rowState, rowIndex);
     if (cellType == DataControlCellType.DataCell)
     {
         Label lbl = new Label();
         int dataIndex = rowIndex + 1;
         if (gridView != null)
         {
             dataIndex += gridView.PageIndex * gridView.PageSize;
         }
         lbl.Text = dataIndex.ToString();
         cell.Controls.Add(lbl);
     }
 }
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            base.InitializeCell(cell, cellType, rowState, rowIndex);

            switch (cellType)
            {
                case DataControlCellType.DataCell:
                    InitializeDataCell(cell, rowState);
                    break;
                case DataControlCellType.Header:
                    break;
                case DataControlCellType.Footer:
                    break;
            }
        }
		public virtual void InitializeCell (DataControlFieldCell cell,
			DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
		{
			if (cellType == DataControlCellType.Header && ShowHeader)
			{
				if (HeaderText.Length > 0 || HeaderImageUrl.Length > 0) {
					if (sortingEnabled && SortExpression.Length > 0)
						cell.Controls.Add (new DataControlButton (control, HeaderText, HeaderImageUrl, DataControlCommands.SortCommandName, SortExpression, true));
					else
						cell.Controls.Add (new DataControlButton (control, HeaderText, HeaderImageUrl, string.Empty, string.Empty, true));
				}
			}
			else if (cellType == DataControlCellType.Footer) {
				cell.Text = FooterText;
			}
		}
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            base.InitializeCell(cell, cellType, rowState, rowIndex);

            if (!String.IsNullOrEmpty(this.DeleteConfirmationText) && this.ShowDeleteButton)
            {
                foreach (Control control in cell.Controls)
                {
                    IButtonControl button = control as IButtonControl;
                    if (button != null && button.CommandName == "Delete")
                    {
                        ((WebControl)control).Attributes.Add("onclick",
                                                             String.Format("if (!confirm('{0}')) return false;", this.DeleteConfirmationText));
                    }
                }
            }
        }
Exemple #49
0
        /// <summary>
        /// Add text or controls to a cell's control collection.
        /// </summary>
        /// <param name="cell"><see cref="System.Web.UI.WebControls.DataControlFieldCell"/></param>
        /// <param name="cellType"><see cref="System.Web.UI.WebControls.DataControlCellType"/></param>
        /// <param name="rowState"><see cref="System.Web.UI.WebControls.DataControlRowState"/></param>
        /// <param name="rowIndex">The index of the row that the <see cref="System.Web.UI.WebControls.DataControlFieldCell"/> is contained in.</param>
        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 (Width != null)
            {
                ItemStyle.Width = Unit.Parse(Width);
            }
            if (cellType == DataControlCellType.DataCell) cell.DataBinding += ItemDataBinding;
            if (cellType == DataControlCellType.DataCell && !tooltip.IsNullOrEmpty()) cell.ToolTip = tooltip;
        }
        /// <summary>
        /// 将指定的 TableCell 对象初始化为指定的行状态。
        /// </summary>
        /// <param name="cell">要初始化的 TableCell。</param>
        /// <param name="cellType">DataControlCellType<see cref="DataControlCellType"/> 值之一。</param>
        /// <param name="rowState">DataControlRowState<see cref="DataControlRowState"/> 值之一。</param>
        /// <param name="rowIndex">从零开始的行索引。</param>
        public override void InitializeCell(DataControlFieldCellEx cell,
            DataControlCellType cellType,
            DataGridViewRowState rowState,
            int rowIndex)
        {
            base.InitializeCell(cell, cellType, rowState, rowIndex);
            DataGridView owner = this.Control as DataGridView;
            if (owner == null)
                return;
            else if (cellType == DataControlCellType.Header)
            {
                ClientScriptManager scriptManager = owner.Page.ClientScript;
                string scriptKey = string.Format("{0}_SelectAll", owner.ClientID);
                if (!scriptManager.IsClientScriptBlockRegistered(this.GetType(), scriptKey))
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append("<script type=\"text/javascript\">\r\n");
                    sb.AppendFormat("function {0}_SelectAll()\r\n", owner.ClientID);
                    sb.Append("{\r\n");
                    sb.AppendFormat("\tvar c=document.all.{0}_cbSelectAll.checked;\r\n", owner.ClientID);
                    sb.AppendFormat("\tvar cb=document.all.{0}.getElementsByTagName(\"input\");\r\n", owner.ClientID);
                    sb.Append("\tif(cb && cb!=null)\r\n");
                    sb.Append("\t{\r\n");
                    sb.Append("\t\tfor(var i=0;i<cb.length;i++)\r\n");
                    sb.Append("\t\t{\r\n");
                    sb.AppendFormat("\t\t\tif(cb[i].type==\"checkbox\" && cb[i].id.indexOf(\"{0}\")>-1)\r\n", owner.ClientID);
                    sb.Append("\t\t\t{\r\n");
                    sb.Append("\t\t\tcb[i].checked=c;\r\n");
                    sb.Append("\t\t\t}\r\n");
                    sb.Append("\t\t}\r\n");
                    sb.Append("\t}\r\n");
                    sb.Append("}\r\n");
                    sb.Append("</script>\r\n");

                    scriptManager.RegisterClientScriptBlock(this.GetType(), scriptKey, sb.ToString());
                }
                HtmlInputCheckBox cb = new HtmlInputCheckBox();
                cb.Attributes["ID"] = string.Format("{0}_cbSelectAll", owner.ClientID);
                cb.Attributes["onclick"] = string.Format("javascript:{0}_SelectAll()", owner.ClientID);
                cell.Controls.Add(cb);
            }
        }
Exemple #51
0
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            base.InitializeCell(cell, cellType, rowState, rowIndex);

            if (Width != null)
            {
                ItemStyle.Width = Unit.Parse(Width);
            }

            if (cellType == DataControlCellType.DataCell)
            {
                var button = new LinkButton { Text = Text, CssClass = ColumnStyle, CommandName = CommandName, ToolTip = ToolTip };

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

                if (!string.IsNullOrEmpty(Message)) { button.OnClientClick = @"return confirm('" + Message + "');"; }

                cell.Controls.Add(button);
            }
        }
 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 InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            base.InitializeCell(cell, cellType, rowState, rowIndex);
            if (cell == null)
            {
                throw new ArgumentNullException("cell");
            }
            CheckBox child = new CheckBox();
            switch (cellType)
            {
                case DataControlCellType.Header:
                {
                    if (this.ShowHead)
                    {
                        child.Text = this.Text;
                        child.ID = "checkboxHead";
                        cell.Controls.Add(child);
                        break;
                    }
                    Label label2 = new Label {
                        Text = this.Text,
                        ID = "label"
                    };
                    Label label = label2;
                    cell.Controls.Add(label);
                    break;
                }
                case DataControlCellType.Footer:
                    return;

                case DataControlCellType.DataCell:
                    child.ID = "checkboxCol";
                    cell.Controls.Add(child);
                    cell.Width = Unit.Pixel(this.CellWidth);
                    return;

                default:
                    return;
            }
            cell.Width = Unit.Pixel(this.HeadWidth);
        }
Exemple #54
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)
            {
                string imagename = (Image.IndexOf(".") > 0) ? Image : Image + ".png";

                var button = new ImageButton { ImageUrl = string.Format(Source, imagename), CssClass = ColumnStyle, CommandName = CommandName, ToolTip = ToolTip };

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

                if (!string.IsNullOrEmpty(Message)) { button.OnClientClick = @"return confirm('" + Message + "');"; }

                cell.Controls.Add(button);
            }
        }
Exemple #55
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 (Width != null) ItemStyle.Width = Unit.Parse(Width);
            if (CommandName.IsNullOrEmpty()) CommandName = "Select";

            if (cellType == DataControlCellType.DataCell && !tooltip.IsNullOrEmpty()) cell.ToolTip = tooltip;

            var control = cell.Controls.Cast<Control>().OfType<IButtonControl>().OfType<Control>().FirstOrDefault();

            if (control != null)
            {
                // workaround: ButtonField.InitializeCell add handler OnDataBindField which tries to get DataField from DataItem
                RemoveEventHandlers(control, "DataBinding");
            }
            cell.DataBinding += ItemDataBinding;
        }
	public virtual void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex) {}
Exemple #57
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;";
			}
		}
Exemple #58
0
        public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
        {
            base.InitializeCell(cell, cellType, rowState, rowIndex);

            if (cellType == DataControlCellType.DataCell)
            {
                Label lbl = new Label();
                lbl.ID = "ExpressionLabel" + this.Expression + rowIndex.ToString();
                if (DesignMode)
                {
                    lbl.Text = "[CalField]";
                }
                else
                {
                    if (tab != null && tab.Columns.Contains(this.Expression)
                        && (gridView != null || detView != null))
                    {
                        lbl.Text = this.Expression;
                    }
                }
                cell.Controls.Add(lbl);
            }
        }
 public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
 {
     base.InitializeCell(cell, cellType, rowState, rowIndex);
     if (cellType == DataControlCellType.DataCell)
     {
         this.InitializeDataCell(cell, rowState);
     }
 }
 /// <summary>
 /// 将文本或控件添加到单元格的控件集合中。
 /// </summary>
 /// <param name="cell"></param>
 /// <param name="cellType"></param>
 /// <param name="rowState"></param>
 /// <param name="rowIndex"></param>
 public override void InitializeCell(DataControlFieldCellEx cell, DataControlCellType cellType, DataGridViewRowState rowState, int rowIndex)
 {
     base.InitializeCell(cell, cellType, rowState, rowIndex);
     ITemplate template = null;
     switch (cellType)
     {
         case DataControlCellType.Header:
             template = this.headerTemplate;
             break;
         case DataControlCellType.Footer:
             template = this.footerTemplate;
             break;
         case DataControlCellType.DataCell:
             template = this.itemTemplate;
             if (((rowState & DataGridViewRowState.AlterNate) != DataGridViewRowState.Normal) && (this.alternatingItemTemplate != null))
                 template = this.alternatingItemTemplate;
             break;
     }
     if (template != null)
     {
         cell.Text = string.Empty;
         template.InstantiateIn(cell);
     }
     else if (cellType == DataControlCellType.DataCell)
         cell.Text = "&nbsp;";
 }