/// <summary> /// Overridden to replace the button with a confirmed button /// </summary> public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType) { base.InitializeCell(cell, columnIndex, itemType); if ( itemType != ListItemType.Footer && itemType != ListItemType.Header ) { WebControl theButton = null; if ( this.ButtonType == ButtonColumnType.LinkButton ) { ConfirmedLinkButton theLinkButton = new ConfirmedLinkButton(); theLinkButton.Text = this.Text; theLinkButton.CommandName = this.CommandName; theLinkButton.CausesValidation = false; theLinkButton.Message = this.Message; theLinkButton.ID = theLinkButton.ClientID; theButton = theLinkButton; } else { ConfirmedButton theNormalButton = new ConfirmedButton(); theNormalButton.Text = this.Text; theNormalButton.CommandName = this.CommandName; theNormalButton.CausesValidation = false; theNormalButton.Message = this.Message; theNormalButton.ID = theNormalButton.ClientID; theButton = theNormalButton; } if (this.DataTextField.Length != 0) { theButton.DataBinding += new EventHandler( OnDataBindColumn ); } cell.Controls.Clear(); cell.Controls.Add(theButton); } }
/// <summary> /// Overridden to replace the button with a confirmed button /// </summary> public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType) { base.InitializeCell(cell, columnIndex, itemType); if (itemType != ListItemType.Footer && itemType != ListItemType.Header) { WebControl theButton = null; if (this.ButtonType == ButtonColumnType.LinkButton) { ConfirmedLinkButton theLinkButton = new ConfirmedLinkButton(); theLinkButton.Text = this.Text; theLinkButton.CommandName = this.CommandName; theLinkButton.CausesValidation = false; theLinkButton.Message = this.Message; theLinkButton.ID = theLinkButton.ClientID; theButton = theLinkButton; } else { ConfirmedButton theNormalButton = new ConfirmedButton(); theNormalButton.Text = this.Text; theNormalButton.CommandName = this.CommandName; theNormalButton.CausesValidation = false; theNormalButton.Message = this.Message; theNormalButton.ID = theNormalButton.ClientID; theButton = theNormalButton; } if (this.DataTextField.Length != 0) { theButton.DataBinding += new EventHandler(OnDataBindColumn); } cell.Controls.Clear(); cell.Controls.Add(theButton); } }
/// <summary> /// Overrides <see cref="EditCommandColumn.InitializeCell"/> /// </summary> public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType) { base.InitializeCell(cell, columnIndex, itemType); if (itemType != ListItemType.Header && itemType != ListItemType.Footer) { ArrayList newCollection = new ArrayList(); for( int i = 0; i < cell.Controls.Count; i++ ) { Control innerControl = cell.Controls[i]; Control newInnerControl = innerControl; if ( innerControl is LinkButton ) { LinkButton oldLink = (LinkButton)innerControl; if ( ( oldLink.CommandName == "Edit" && this.EditMessage.Length > 0 ) || ( oldLink.CommandName == "Update" && this.UpdateMessage.Length > 0 ) || ( oldLink.CommandName == "Cancel" && this.CancelMessage.Length > 0 ) ) { ConfirmedLinkButton myLink = new ConfirmedLinkButton(); myLink.CommandName = oldLink.CommandName; myLink.Text = oldLink.Text; myLink.CausesValidation = false; myLink.ID = myLink.ClientID; if ( myLink.CommandName == "Edit" ) { myLink.Message = this.EditMessage; } if ( myLink.CommandName == "Update" ) { myLink.Message = this.UpdateMessage; } if ( myLink.CommandName == "Cancel" ) { myLink.Message = this.CancelMessage; } newInnerControl = myLink; } } if ( innerControl is Button ) { Button oldButton = (Button)innerControl; if ( ( oldButton.CommandName == "Edit" && this.EditMessage.Length > 0 ) || ( oldButton.CommandName == "Update" && this.UpdateMessage.Length > 0 ) || ( oldButton.CommandName == "Cancel" && this.CancelMessage.Length > 0 ) ) { ConfirmedButton myButton = new ConfirmedButton(); myButton.CommandName = oldButton.CommandName; myButton.Text = oldButton.Text; myButton.CausesValidation = false; myButton.ID = myButton.ClientID; if ( myButton.CommandName == "Edit" ) { myButton.Message = this.EditMessage; } if ( myButton.CommandName == "Update" ) { myButton.Message = this.UpdateMessage; } if ( myButton.CommandName == "Cancel" ) { myButton.Message = this.CancelMessage; } newInnerControl = myButton; } } newCollection.Add( newInnerControl ); } cell.Controls.Clear(); foreach( Object aControl in newCollection ) { cell.Controls.Add( (Control)aControl ); } } }
/// <summary> /// Overrides <see cref="EditCommandColumn.InitializeCell"/> /// </summary> public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType) { base.InitializeCell(cell, columnIndex, itemType); if (itemType != ListItemType.Header && itemType != ListItemType.Footer) { ArrayList newCollection = new ArrayList(); for (int i = 0; i < cell.Controls.Count; i++) { Control innerControl = cell.Controls[i]; Control newInnerControl = innerControl; if (innerControl is LinkButton) { LinkButton oldLink = (LinkButton)innerControl; if ( (oldLink.CommandName == "Edit" && this.EditMessage.Length > 0) || (oldLink.CommandName == "Update" && this.UpdateMessage.Length > 0) || (oldLink.CommandName == "Cancel" && this.CancelMessage.Length > 0)) { ConfirmedLinkButton myLink = new ConfirmedLinkButton(); myLink.CommandName = oldLink.CommandName; myLink.Text = oldLink.Text; myLink.CausesValidation = false; myLink.ID = myLink.ClientID; if (myLink.CommandName == "Edit") { myLink.Message = this.EditMessage; } if (myLink.CommandName == "Update") { myLink.Message = this.UpdateMessage; } if (myLink.CommandName == "Cancel") { myLink.Message = this.CancelMessage; } newInnerControl = myLink; } } if (innerControl is Button) { Button oldButton = (Button)innerControl; if ( (oldButton.CommandName == "Edit" && this.EditMessage.Length > 0) || (oldButton.CommandName == "Update" && this.UpdateMessage.Length > 0) || (oldButton.CommandName == "Cancel" && this.CancelMessage.Length > 0)) { ConfirmedButton myButton = new ConfirmedButton(); myButton.CommandName = oldButton.CommandName; myButton.Text = oldButton.Text; myButton.CausesValidation = false; myButton.ID = myButton.ClientID; if (myButton.CommandName == "Edit") { myButton.Message = this.EditMessage; } if (myButton.CommandName == "Update") { myButton.Message = this.UpdateMessage; } if (myButton.CommandName == "Cancel") { myButton.Message = this.CancelMessage; } newInnerControl = myButton; } } newCollection.Add(newInnerControl); } cell.Controls.Clear(); foreach (Object aControl in newCollection) { cell.Controls.Add((Control)aControl); } } }