Scenario
Among the controls on a page is an update panel with a button that when clicked causes a partial postback that takes at least a few seconds. During this time you want to show the user a wait message that will disappear as soon as the postBack completes.
(more…)
Question
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?
Solution
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="">
<ContentTemplate>
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel runat="server" ID="tpName" HeaderText="Name">
<ContentTemplate>
Name:
<asp:TextBox runat="server" ID="txtName" />
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel runat="server" ID="tpEmail" HeaderText="Email">
<ContentTemplate>
Email:
<asp:TextBox runat="server" ID="txtEmail" />
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer> |
function pageLoad(sender, e)
{
var objTpDummy =
document.getElementById('<%= tpDummy.ClientID %>' + '_tab');
objTpDummy.style.display = 'none';
} |
Scenario
A page has a list of images for the user to choose from. When a file is selected the request is processed via an AJAX call that directs the source of an iFrame to another page where the image is generated and passed back to the client.
Due to the size of some of the images, the generation can take a noticeable amount of time. To make sure the user does not think the site is frozen a wait message is needed. Since the generating page only returns the image, we need another way to notify the client when the file is generated and the wait message can be hidden.
(more…)