Link to home
Start Free TrialLog in
Avatar of emresamisuzer
emresamisuzer

asked on

Ajax UpdateProgress inside Tab Control

I want to place an updateprogress inside every tab of an ajax tab control. It works but it triggers the OnActiveTabChanged event of tab control twice on every tab change.

You may see the test page below.
<form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div style="height: 100%;">
        <asp:UpdatePanel ID="up_test" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <atk:TabContainer runat="server" Height="150px" ID="tc_test" OnActiveTabChanged="TabFunction"
                    AutoPostBack="true">
                    <atk:TabPanel ID="TabPanel1" runat="server" HeaderText="Tab Page 1">
                        <HeaderTemplate>
                            Tab Page 1
                        </HeaderTemplate>
                        <ContentTemplate>
                            <asp:UpdateProgress ID="uprg_test" AssociatedUpdatePanelID="up_test" runat="server"
                                DisplayAfter="0">
                                <ProgressTemplate>
                                    <div style="height: 100%; background-color: Fuchsia; position: absolute; left: 0;
                                        top: 20px; padding: 0; width: 100%;">
                                        LOADING...
                                    </div>
                                </ProgressTemplate>
                            </asp:UpdateProgress>
                            <asp:Literal ID="Literal1" runat="server"></asp:Literal>
                        </ContentTemplate>
                    </atk:TabPanel>
                    <atk:TabPanel ID="TabPanel2" runat="server" HeaderText="Tab Page 2">
                        <ContentTemplate>
                            <asp:UpdateProgress ID="uprg_test2" AssociatedUpdatePanelID="up_test" runat="server"
                                DisplayAfter="0">
                                <ProgressTemplate>
                                    <div style="height: 100%; background-color: Navy; position: absolute; left: 0;
                                        top: 20px; padding: 0; width: 100%;">
                                        LOADING...
                                    </div>
                                </ProgressTemplate>
                            </asp:UpdateProgress>
                            <asp:Literal ID="Literal2" runat="server"></asp:Literal>
                        </ContentTemplate>
                    </atk:TabPanel>
                </atk:TabContainer>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    </form>

Public Sub TabFunction(ByVal sender As Object, ByVal e As EventArgs)
        Select Case tc_test.ActiveTabIndex
            Case 0
                Literal1.Text = Now.ToString
            Case 1
                Literal2.Text = Now.ToString
        End Select
        System.Threading.Thread.Sleep(2000)
        up_test.Update()
    End Sub

Open in new window

Avatar of masterpass
masterpass
Flag of India image

In the page_load, have a !IsPostBack Check

if(!IsPostBack)
{
// rest of the code in page_load here
}

If this is not working .. post your page_load here
Avatar of emresamisuzer
emresamisuzer

ASKER

There is no page_load block.
ASKER CERTIFIED SOLUTION
Avatar of masterpass
masterpass
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial