コード例 #1
0
ファイル: ButtonField.cs プロジェクト: pmq20/mono_forked
        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);
            }
        }
コード例 #2
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 : " ";
         }
     }
     else if (cellType == DataControlCellType.Footer)
     {
         string footerText = FooterText;
         cell.Text = (footerText.Length > 0) ? footerText : " ";
     }
 }
コード例 #3
0
        Control CreateButton(string text, string image, string command, string arg)
        {
            IDataControlButton c = DataControlButton.CreateButton(ButtonType, Control, text, image, command, arg, false);

            if (CausesValidation)
            {
                if (command == DataControlCommands.UpdateCommandName || command == DataControlCommands.InsertCommandName)
                {
                    c.Container        = null;
                    c.CausesValidation = true;
                    c.ValidationGroup  = ValidationGroup;
                }
            }
            return((Control)c);
        }
コード例 #4
0
ファイル: PagerSettings.cs プロジェクト: pmq20/mono_forked
        TableCell CreateCell(string text, string image, string command, string argument)
        {
            TableCell cell = new TableCell();

            Control button;

            if (String.IsNullOrEmpty(command))
            {
                Label l = new Label();
                l.Text = text;
                button = l;
            }
            else
            {
                button = (Control)DataControlButton.CreateButton(String.IsNullOrEmpty(image) ? ButtonType.Link : ButtonType.Image, ctrl, text, image, command, argument, true);
            }

            cell.Controls.Add(button);
            return(cell);
        }