AspNetWrapper<T>
Namespace: Wisej.Web.Ext.AspNetControl
Assembly: Wisej.Web.Ext.AspNetControl (4.1.0.0)
The AspNetWrapperBase is the base class of all wrapped ASP.NET controls.
- C#
- VB.NET
public class AspNetWrapper<T> : AspNetWrapperBase
Public Class AspNetWrapper(Of T)
Inherits AspNetWrapperBase
When you using a wrapped ASP.NET control you must add the HttpModule to Web.config, like this:
<system.webServer>
<modules>
<add name = "WisejAspNetControl" type="Wisej.Web.Ext.AspNetControl.HttpModule, Wisej.Web.Ext.AspNetControl" />
...
Example:
The following example wraps the ASP.NET Calendar control and exposes the selected date to the Wisej application:
public class CalendarWrapper : AspNetWrapper<System.Web.UI.WebControls.Calendar>
{
public DateTime SelectedDate { get; set; } = DateTime.Today;
public event EventHandler SelectionChanged;
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
// The wrapped control is only available during the page life cycle events.
this.WrappedControl.SelectionChanged += (s, args) =>
{
this.SelectedDate = this.WrappedControl.SelectedDate;
this.SelectionChanged?.Invoke(this, EventArgs.Empty);
};
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!this.IsPostBack)
this.WrappedControl.SelectedDate = this.SelectedDate;
}
}
// Use the wrapper like any other Wisej control:
var calendar = new CalendarWrapper { Dock = DockStyle.Fill };
calendar.SelectionChanged += (s, e) => AlertBox.Show(calendar.SelectedDate.ToShortDateString());
this.Controls.Add(calendar);
Constructors
AspNetWrapper()
Initializes a new instance of AspNetWrapper.
Properties
Url
String: Returns source Url of the IFrame. (Default: "")
WrappedControl
T: Returns the instance of the wrapped ASP.NET control. It is valid only during the processing of the Init or the Load events.
Methods
CreateHostedControl()
Creates the wrapped control.
Returns: WebControl.