The AsyncUserControl is an Async-Enhanced implementation of the asp:UserControl.
<%@ Register Assembly="AsyncControls" Namespace="DelvingWare.AsyncControls" TagPrefix="dw" %> <%@ Register Src="~/Controls/AsyncUserControl.ascx" TagName="asyncUserCtrl" TagPrefix="ctr" %> <dw:AsyncButton runat="server" ID="btMain" Text="Hide the AsyncUserControl" OnClick="btMain_Click" CssClass="greyButton" /> <ctr:asyncUserCtrl runat="server" ID="asyncUserCtrl" /> <br/> <i>All the AsyncControl demos are within AsyncUserControls</i>.
using System; using DelvingWare.AsyncControls; ... protected void btMain_Click( object sender, AsyncEventArgs ae ) { bool visible = asyncUserCtrl.Visible; // change the AsyncButton text if ( visible ) btMain.Text = "Show the AsyncUserControl"; else btMain.Text = "Hide the AsyncUserControl"; // change the AsyncUserControl visibility asyncUserCtrl.Visible = !visible; }
Imports System Imports DelvingWare.AsyncControls ... Protected Sub btMain_Click(ByVal sender As Object, ByVal ae As AsyncEventArgs) Dim visible As Boolean = asyncUserCtrl.Visible ' change the AsyncButton text If visible Then btMain.Text = "Show the AsyncUserControl" Else btMain.Text = "Hide the AsyncUserControl" End If ' change the AsyncUserControl visibility asyncUserCtrl.Visible = Not visible End Sub