Beispiel #1
0
        Control CreateButton(ButtonColumnType type, string text, string command, bool valid)
        {
            Button     b;
            LinkButton d;

            if (type == ButtonColumnType.LinkButton)
            {
                d                  = new ForeColorLinkButton();
                d.Text             = text;
                d.CommandName      = command;
                d.CausesValidation = valid;
                if (valid)
                {
                    d.ValidationGroup = ValidationGroup;
                }
                return(d);
            }

            b                  = new Button();
            b.Text             = text;
            b.CommandName      = command;
            b.CausesValidation = valid;
            if (valid)
            {
                b.ValidationGroup = ValidationGroup;
            }

            return(b);
        }
Beispiel #2
0
        private void AddButtonToCell(TableCell cell, string commandName, string buttonText, bool causesValidation, string validationGroup)
        {
            WebControl        buttonControl = null;
            ControlCollection controls      = cell.Controls;
            ButtonColumnType  buttonType    = ButtonType;

            if (buttonType == ButtonColumnType.LinkButton)
            {
                LinkButton button = new DataGridLinkButton();

                buttonControl           = button;
                button.CommandName      = commandName;
                button.Text             = buttonText;
                button.CausesValidation = causesValidation;
                button.ValidationGroup  = validationGroup;
            }
            else
            {
                Button button = new Button();

                buttonControl           = button;
                button.CommandName      = commandName;
                button.Text             = buttonText;
                button.CausesValidation = causesValidation;
                button.ValidationGroup  = validationGroup;
            }

            controls.Add(buttonControl);
        }
Beispiel #3
0
 protected void InitEditCommandColumn(bool image, ButtonColumnType type, string cancelText, string editText, string headerText, string footerText, string locationImage, string sort, string updateText, bool visible)
 {
     System.Web.UI.WebControls.EditCommandColumn column = new EditCommandColumn();
     column.ButtonType = type;
     column.CancelText = cancelText;
     column.EditText   = editText;
     column.FooterText = footerText;
     column.HeaderText = headerText;
     if (image)
     {
         column.HeaderImageUrl = locationImage;
     }
     column.SortExpression = sort;
     column.UpdateText     = updateText;
     column.Visible        = visible;
 }
Beispiel #4
0
 protected void InitButtonColumn(bool image, ButtonColumnType type, string commandName, string text, string dataTextField, string dataFormatString, string footerText, string headerText, string LocationImage, string Sort, bool Visible)
 {
     System.Web.UI.WebControls.ButtonColumn ButtonColumToAdd = new ButtonColumn();
     ButtonColumToAdd.ButtonType           = type;
     ButtonColumToAdd.CommandName          = commandName;
     ButtonColumToAdd.DataTextField        = dataTextField;
     ButtonColumToAdd.DataTextFormatString = dataFormatString;
     ButtonColumToAdd.HeaderText           = headerText;
     ButtonColumToAdd.FooterText           = footerText;
     if (image)
     {
         ButtonColumToAdd.HeaderImageUrl = LocationImage;
     }
     ButtonColumToAdd.SortExpression = Sort;
     ButtonColumToAdd.Visible        = Visible;
     ButtonColumToAdd.Text           = text;
 }
 public override void LoadColumnInfo()
 {
     base.LoadColumnInfo();
     EditCommandColumn runtimeColumn = (EditCommandColumn) base.RuntimeColumn;
     this.editText = runtimeColumn.EditText;
     this.updateText = runtimeColumn.UpdateText;
     this.cancelText = runtimeColumn.CancelText;
     this.buttonType = runtimeColumn.ButtonType;
 }
 public override void LoadColumnInfo()
 {
     base.LoadColumnInfo();
     ButtonColumn runtimeColumn = (ButtonColumn) base.RuntimeColumn;
     this.command = runtimeColumn.CommandName;
     this.buttonText = runtimeColumn.Text;
     this.buttonDataTextField = runtimeColumn.DataTextField;
     this.buttonDataTextFormatString = runtimeColumn.DataTextFormatString;
     this.buttonType = runtimeColumn.ButtonType;
     base.UpdateDisplayText();
 }
		Control CreateButton(ButtonColumnType type, string text, string command, bool valid) {
			Button b;
			LinkButton d;

			if (type == ButtonColumnType.LinkButton) {
				d = new ForeColorLinkButton();
				d.Text = text;
				d.CommandName = command;
				d.CausesValidation = valid;
#if NET_2_0
				if (valid) {
					d.ValidationGroup = ValidationGroup;
				}
#endif
				return d;
			}

			b = new Button();
			b.Text = text;
			b.CommandName = command;
			b.CausesValidation = valid;
#if NET_2_0
			if (valid) {
				b.ValidationGroup = ValidationGroup;
			}
#endif
			return b;
		}
        /// <include file='doc\EditCommandColumn.uex' path='docs/doc[@for="EditCommandColumn.InitializeCell"]/*' />
        /// <devdoc>
        ///    <para>Initializes a cell within the column.</para>
        /// </devdoc>
        public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType)
        {
            base.InitializeCell(cell, columnIndex, itemType);

            if ((itemType != ListItemType.Header) &&
                (itemType != ListItemType.Footer))
            {
                if (itemType == ListItemType.EditItem)
                {
                    ControlCollection controls      = cell.Controls;
                    ButtonColumnType  buttonType    = ButtonType;
                    WebControl        buttonControl = null;

                    if (buttonType == ButtonColumnType.LinkButton)
                    {
                        LinkButton button = new DataGridLinkButton();

                        buttonControl      = button;
                        button.CommandName = DataGrid.UpdateCommandName;
                        button.Text        = UpdateText;
                    }
                    else
                    {
                        Button button = new Button();

                        buttonControl      = button;
                        button.CommandName = DataGrid.UpdateCommandName;
                        button.Text        = UpdateText;
                    }

                    controls.Add(buttonControl);

                    LiteralControl spaceControl = new LiteralControl("&nbsp;");
                    controls.Add(spaceControl);

                    if (buttonType == ButtonColumnType.LinkButton)
                    {
                        LinkButton button = new DataGridLinkButton();

                        buttonControl           = button;
                        button.CommandName      = DataGrid.CancelCommandName;
                        button.Text             = CancelText;
                        button.CausesValidation = false;
                    }
                    else
                    {
                        Button button = new Button();

                        buttonControl           = button;
                        button.CommandName      = DataGrid.CancelCommandName;
                        button.Text             = CancelText;
                        button.CausesValidation = false;
                    }

                    controls.Add(buttonControl);
                }
                else
                {
                    ControlCollection controls      = cell.Controls;
                    ButtonColumnType  buttonType    = ButtonType;
                    WebControl        buttonControl = null;

                    if (buttonType == ButtonColumnType.LinkButton)
                    {
                        LinkButton button = new DataGridLinkButton();

                        buttonControl           = button;
                        button.CommandName      = DataGrid.EditCommandName;
                        button.Text             = EditText;
                        button.CausesValidation = false;
                    }
                    else
                    {
                        Button button = new Button();

                        buttonControl           = button;
                        button.CommandName      = DataGrid.EditCommandName;
                        button.Text             = EditText;
                        button.CausesValidation = false;
                    }

                    controls.Add(buttonControl);
                }
            }
        }