Наследование от стандартных Control - ов

  • Автор темы Basilevs
  • Дата начала
Статус
Закрыто для дальнейших ответов.
B

Basilevs

#1
Помогите, пожалуйста, найти грамотный пример наследования от Button - a. Или на крайняк от любого Control - a. Спасибо заранее!
 
K

karlito

#2
Используй рефлектор и посмотри внутренности стандартных контролов. Это будет тебе лучший пример.
 
N

NikSoft

#3
Помогите найти грамотный пример наследования от Button
Пример наследования от Button для классов из BCL( Base Class Library )

Код:
[ToolboxData("<{0}:Button runat=\"server\" Text=\"Button\"></{0}:Button>"), Designer("System.Web.UI.Design.WebControls.ButtonDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), DefaultEvent("Click"), DataBindingHandler("System.Web.UI.Design.TextDataBindingHandler, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), DefaultProperty("Text"), SupportsEventValidation, AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public class Button : WebControl, IButtonControl, IPostBackEventHandler
{
// Events
[WebCategory("Action"), WebSysDescription("Button_OnClick")]
public event EventHandler Click;
[WebCategory("Action"), WebSysDescription("Button_OnCommand")]
public event CommandEventHandler Command;

// Methods
static Button();
public Button();
protected override void AddAttributesToRender(HtmlTextWriter writer);
protected virtual PostBackOptions GetPostBackOptions();
protected virtual void OnClick(EventArgs e);
protected virtual void OnCommand(CommandEventArgs e);
protected internal override void OnPreRender(EventArgs e);
protected virtual void RaisePostBackEvent(string eventArgument);
protected internal override void RenderContents(HtmlTextWriter writer);
void IPostBackEventHandler.RaisePostBackEvent(string eventArgument);

// Properties
[Themeable(false), WebSysDescription("Button_CausesValidation"), DefaultValue(true), WebCategory("Behavior")]
public virtual bool CausesValidation { get; set; }
[WebCategory("Behavior"), Themeable(false), WebSysDescription("WebControl_CommandArgument"), Bindable(true), DefaultValue("")]
public string CommandArgument { get; set; }
[WebSysDescription("WebControl_CommandName"), DefaultValue(""), Themeable(false), WebCategory("Behavior")]
public string CommandName { get; set; }
[WebCategory("Behavior"), DefaultValue(""), Themeable(false), WebSysDescription("Button_OnClientClick")]
public virtual string OnClientClick { get; set; }
[UrlProperty("*.aspx"), DefaultValue(""), Themeable(false), Editor("System.Web.UI.Design.UrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor)), WebCategory("Behavior"), WebSysDescription("Button_PostBackUrl")]
public virtual string PostBackUrl { get; set; }
[Bindable(true), Localizable(true), WebCategory("Appearance"), DefaultValue(""), WebSysDescription("Button_Text")]
public string Text { get; set; }
[WebCategory("Behavior"), Themeable(false), DefaultValue(true), WebSysDescription("Button_UseSubmitBehavior")]
public virtual bool UseSubmitBehavior { get; set; }
[DefaultValue(""), Themeable(false), WebCategory("Behavior"), WebSysDescription("PostBackControl_ValidationGroup")]
public virtual string ValidationGroup { get; set; }

// Fields
private static readonly object EventClick;
private static readonly object EventCommand;
}

[SupportsEventValidation]
internal sealed class DataControlButton : Button
{
// Methods
internal DataControlButton(IPostBackContainer container);
protected sealed override PostBackOptions GetPostBackOptions();

// Properties
public override bool CausesValidation { get; set; }
public override bool UseSubmitBehavior { get; set; }

// Fields
private IPostBackContainer _container;
}


[SupportsEventValidation]
internal sealed class ZoneButton : Button
{
// Methods
public ZoneButton(WebZone owner, string eventArgument);
protected override PostBackOptions GetPostBackOptions();

// Properties
[DefaultValue(false)]
public override bool UseSubmitBehavior { get; set; }

// Fields
private string _eventArgument;
private WebZone _owner;
}
 
Статус
Закрыто для дальнейших ответов.