Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

How do I lazy load User Controls with TabContainer OnDemand?

$
0
0

This is cross-posted to stack overflow, but I realized that the forum may be a better place for this.

In Stephen Walter's example, the SqlDataSource's selecting event doesn't execute until the second tab has been clicked.  What is it in the SqlDataSource/GridView event pipeline that allows that to happen?

I have tab panels with User Controls in them, and I'd like to do something similar, following the ASP.NET lifecycle.  Currently, the user controls do a bunch of work in the OnLoad event.  But, this fires whether the tab is active or not.  

<ajaxToolkit:TabContainer ID="TabContainer1" ActiveTabIndex="0" OnDemand="True" runat="server"><ajaxToolkit:TabPanel ID="TabPanel1" HeaderText="tab 1" runat="server" ><ContentTemplate><UC:Tab1 runat="server" /></ContentTemplate></ajaxToolkit:TabPanel><ajaxToolkit:TabPanel ID="TabPanel2" HeaderText="tab 2" runat="server"><ContentTemplate><UC:Tab2 runat="server" /></ContentTemplate></ajaxToolkit:TabPanel></ajaxToolkit:TabContainer>

// In user control
protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
    presenter.BuildView();  // this is what I want to delay until the tab is active
}

How can I avoid executing this code like the SqlDataSource does?  


Viewing all articles
Browse latest Browse all 5678

Latest Images

Trending Articles



Latest Images