protected override PostBackOptions GetPostBackOptions() { IPostBackContainer pcner = Container as IPostBackContainer; if (pcner != null) { return(pcner.GetPostBackOptions(this)); } return(base.GetPostBackOptions()); }
private void AddButtonToCell(DataControlFieldCell cell, string commandName, string buttonText, bool causesValidation, string validationGroup, int rowIndex, string imageUrl) { IButtonControl control; IPostBackContainer container = base.Control as IPostBackContainer; bool flag = true; switch (this.ButtonType) { case ButtonType.Button: if ((container == null) || causesValidation) { control = new Button(); } else { control = new DataControlButton(container); flag = false; } break; case ButtonType.Link: if ((container == null) || causesValidation) { control = new DataControlLinkButton(null); } else { control = new DataControlLinkButton(container); flag = false; } break; default: if ((container != null) && !causesValidation) { control = new DataControlImageButton(container); flag = false; } else { control = new ImageButton(); } ((ImageButton)control).ImageUrl = imageUrl; break; } control.Text = buttonText; control.CommandName = commandName; control.CommandArgument = rowIndex.ToString(CultureInfo.InvariantCulture); if (flag) { control.CausesValidation = causesValidation; } control.ValidationGroup = validationGroup; cell.Controls.Add((WebControl)control); }
public DeluxePagerLinkButton(IPostBackContainer container) { this.container = container; }
// Methods internal DataControlLinkButton(IPostBackContainer container) { this._container = container; }
public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex) { base.InitializeCell(cell, cellType, rowState, rowIndex); if ((cellType != DataControlCellType.Header) && (cellType != DataControlCellType.Footer)) { IButtonControl control; IPostBackContainer container = base.Control as IPostBackContainer; bool causesValidation = this.CausesValidation; bool flag2 = true; switch (this.ButtonType) { case ButtonType.Button: if ((container == null) || causesValidation) { control = new Button(); } else { control = new DataControlButton(container); flag2 = false; } break; case ButtonType.Link: if ((container == null) || causesValidation) { control = new DataControlLinkButton(null); } else { control = new DataControlLinkButton(container); flag2 = false; } break; default: if ((container != null) && !causesValidation) { control = new DataControlImageButton(container); flag2 = false; } else { control = new ImageButton(); } ((ImageButton)control).ImageUrl = this.ImageUrl; break; } control.Text = this.Text; control.CommandName = this.CommandName; control.CommandArgument = rowIndex.ToString(CultureInfo.InvariantCulture); if (flag2) { control.CausesValidation = causesValidation; } control.ValidationGroup = this.ValidationGroup; if ((this.DataTextField.Length != 0) && base.Visible) { ((WebControl)control).DataBinding += new EventHandler(this.OnDataBindField); } cell.Controls.Add((WebControl)control); } }
internal DataControlButton(IPostBackContainer container) { _container = container; }
/// <summary> /// 构造函数。 /// </summary> /// <param name="container"></param> public DataControlPagerLinkButton(IPostBackContainer container) : base(container) { }
internal DataControlImageButton(IPostBackContainer container) { this._container = container; }
internal DataControlPagerLinkButton(IPostBackContainer container) : base(container) { }
/// <summary> /// 构造函数。 /// </summary> /// <param name="container"></param> public DataControlLinkButton(IPostBackContainer container) { this.container = container; }
public PagerLinkButton(IPostBackContainer container) { _container = container; }
public virtual void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex) { WebControl control; string sortExpression; string headerText; ImageButton button; switch (cellType) { case DataControlCellType.Header: { control = null; sortExpression = this.SortExpression; bool flag = this._sortingEnabled && (sortExpression.Length > 0); string headerImageUrl = this.HeaderImageUrl; headerText = this.HeaderText; if (headerImageUrl.Length == 0) { if (flag) { LinkButton button2; IPostBackContainer container2 = this._control as IPostBackContainer; if (container2 != null) { button2 = new DataControlLinkButton(container2); ((DataControlLinkButton)button2).EnableCallback(null); } else { button2 = new LinkButton(); } button2.Text = headerText; button2.CommandName = "Sort"; button2.CommandArgument = sortExpression; if (!(button2 is DataControlLinkButton)) { button2.CausesValidation = false; } control = button2; } else { if (headerText.Length == 0) { headerText = " "; } cell.Text = headerText; } goto Label_015C; } if (!flag) { Image image = new Image { ImageUrl = headerImageUrl }; control = image; image.AlternateText = headerText; goto Label_015C; } IPostBackContainer container = this._control as IPostBackContainer; if (container == null) { button = new ImageButton(); break; } button = new DataControlImageButton(container); ((DataControlImageButton)button).EnableCallback(null); break; } case DataControlCellType.Footer: { string footerText = this.FooterText; if (footerText.Length == 0) { footerText = " "; } cell.Text = footerText; return; } default: return; } button.ImageUrl = this.HeaderImageUrl; button.CommandName = "Sort"; button.CommandArgument = sortExpression; if (!(button is DataControlImageButton)) { button.CausesValidation = false; } button.AlternateText = headerText; control = button; Label_015C: if (control != null) { cell.Controls.Add(control); } }
/// <devdoc> /// <para>Initializes a cell in the System.Web.UI.WebControls.Field.</para> /// </devdoc> public virtual void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex) { switch (cellType) { case DataControlCellType.Header: { WebControl headerControl = null; string sortExpression = SortExpression; bool sortableHeader = (_sortingEnabled && sortExpression.Length > 0); string headerImageUrl = HeaderImageUrl; string headerText = HeaderText; if (headerImageUrl.Length != 0) { if (sortableHeader) { ImageButton sortButton; IPostBackContainer container = _control as IPostBackContainer; if (container != null) { sortButton = new DataControlImageButton(container); ((DataControlImageButton)sortButton).EnableCallback(null); // no command argument for the callback uses Sort } else { sortButton = new ImageButton(); } sortButton.ImageUrl = HeaderImageUrl; sortButton.CommandName = DataControlCommands.SortCommandName; sortButton.CommandArgument = sortExpression; if (!(sortButton is DataControlImageButton)) { sortButton.CausesValidation = false; } sortButton.AlternateText = headerText; headerControl = sortButton; } else { Image headerImage = new Image(); headerImage.ImageUrl = headerImageUrl; headerControl = headerImage; headerImage.AlternateText = headerText; } } else { if (sortableHeader) { LinkButton sortButton; IPostBackContainer container = _control as IPostBackContainer; if (container != null) { sortButton = new DataControlLinkButton(container); ((DataControlLinkButton)sortButton).EnableCallback(null); // no command argument for the callback uses Sort } else { sortButton = new LinkButton(); } sortButton.Text = headerText; sortButton.CommandName = DataControlCommands.SortCommandName; sortButton.CommandArgument = sortExpression; if (!(sortButton is DataControlLinkButton)) { sortButton.CausesValidation = false; } headerControl = sortButton; } else { if (headerText.Length == 0) { // the browser does not render table borders for cells with nothing // in their content, so we add a non-breaking space. headerText = " "; } cell.Text = headerText; } } if (headerControl != null) { cell.Controls.Add(headerControl); } } break; case DataControlCellType.Footer: { string footerText = FooterText; if (footerText.Length == 0) { // the browser does not render table borders for cells with nothing // in their content, so we add a non-breaking space. footerText = " "; } cell.Text = footerText; } break; } }
public DataControlImageButton(IPostBackContainer container) { _container = container; }
public DataControlLinkButton(IPostBackContainer container) { _container = container; }
private void AddButtonToCell(DataControlFieldCell cell, string commandName, string buttonText, bool causesValidation, string validationGroup, int rowIndex, string imageUrl) { IButtonControl button; IPostBackContainer container = Control as IPostBackContainer; bool setCausesValidation = true; // the setter on the DataControlButtons throw if there's a container for security switch (ButtonType) { case ButtonType.Link: { if (container != null && !causesValidation) { button = new DataControlLinkButton(container); setCausesValidation = false; } else { button = new DataControlLinkButton(null); } break; } case ButtonType.Button: { if (container != null && !causesValidation) { button = new DataControlButton(container); setCausesValidation = false; } else { button = new Button(); } break; } case ButtonType.Image: default: { if (container != null && !causesValidation) { button = new DataControlImageButton(container); setCausesValidation = false; } else { button = new ImageButton(); } ((ImageButton)button).ImageUrl = imageUrl; break; } } button.Text = buttonText; button.CommandName = commandName; button.CommandArgument = rowIndex.ToString(CultureInfo.InvariantCulture); if (setCausesValidation) { button.CausesValidation = causesValidation; } button.ValidationGroup = validationGroup; cell.Controls.Add((WebControl)button); }
internal RepeaterXPagerLinkButton(IPostBackContainer container) { this.container = container; }
/// <devdoc> /// <para>Initializes a cell in the <see cref='System.Web.UI.WebControls.ButtonField'/> .</para> /// </devdoc> public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex) { base.InitializeCell(cell, cellType, rowState, rowIndex); if ((cellType != DataControlCellType.Header) && (cellType != DataControlCellType.Footer)) { IButtonControl button; IPostBackContainer container = Control as IPostBackContainer; bool causesValidation = CausesValidation; bool setCausesValidation = true; // the setter on the DataControlButtons throw if there's a container for security switch (ButtonType) { case ButtonType.Link: { if (container != null && !causesValidation) { button = new DataControlLinkButton(container); setCausesValidation = false; } else { // use DataControlLinkButton because it uses the right forecolor button = new DataControlLinkButton(null); } break; } case ButtonType.Button: { if (container != null && !causesValidation) { button = new DataControlButton(container); setCausesValidation = false; } else { button = new Button(); } break; } case ButtonType.Image: default: { if (container != null && !causesValidation) { button = new DataControlImageButton(container); setCausesValidation = false; } else { button = new ImageButton(); } ((ImageButton)button).ImageUrl = ImageUrl; break; } } button.Text = Text; button.CommandName = CommandName; button.CommandArgument = rowIndex.ToString(CultureInfo.InvariantCulture); if (setCausesValidation) { button.CausesValidation = causesValidation; } button.ValidationGroup = ValidationGroup; if (DataTextField.Length != 0 && Visible) { ((WebControl)button).DataBinding += new EventHandler(this.OnDataBindField); } cell.Controls.Add((WebControl)button); } }