Lions Den

The Code and Times of Hanan Schwartzberg

About Hanan | Hanan's CV | Contact Hanan

August 12, 2009

Default a TabContainer to No Tabs Selected


Under normal circumstances when a page loads with a tabContainer on it one tab must be selected. The selected tab can be specified via the ActiveTabIndex property. What if the tabContainer needs to default to an empty tab with none of the tabs selected?


Add a dummy tabPanel to the tabContainer and leave it blank. Use the pageLoad JavaScript function to hide the tab’s header

<cc1:TabContainer ID="TabContainer1" runat="server" 
    Height="200px" Width="200px" ActiveTabIndex="0">
    <cc1:TabPanel runat="server" ID="tpDummy" HeaderText="">
    <cc1:TabPanel runat="server" ID="tpName" HeaderText="Name">
            <asp:TextBox runat="server" ID="txtName" />
    <cc1:TabPanel runat="server" ID="tpEmail" HeaderText="Email">
            <asp:TextBox runat="server" ID="txtEmail" />
function pageLoad(sender, e)
    var objTpDummy = 
        document.getElementById('<%= tpDummy.ClientID %>' + '_tab'); = 'none';

February 15, 2009

Hide the contents of the page until the entire page has loaded

Filed under: ASP.NET,Client Side — Tags: , , — Hanan Schwartzberg @ 12:14 pm

There are several reasons you may want to keep the controls on the page hidden until the page has loaded. If the user enters data before all the controls are loaded it may cause an error, or you may just not want the user to see the page rendering. The example below shows how to hide the controls from the user and instead display a loading message.


Home | Site Design | Banner Design | Code Den | Offsite Posts | Downloads | Photography | About Hanan | Hanan's CV | Contact Hanan
Copyright © 2009 Hanan Schwartzberg. All rights reserved.