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

emresamisuzerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

masterpassCommented:
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
0
emresamisuzerAuthor Commented:
There is no page_load block.
0
masterpassCommented:
As a work around, you could do some thing like this

<atk:TabContainer runat="server" height="150px" id="tc_test" autopostback="true">

</atk:TabContainer

Nb: I have removed the OnActiveTabChanged event
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    If IsPostBack Then
        TabFunction()
    End If
End Sub



Public Sub TabFunction()
    Select Case tc_test.ActiveTabIndex
        Case 0
            Literal1.Text = DateTime.Now.ToString()
            Exit Select
        Case 1
            Literal2.Text = DateTime.Now.ToString()
            Exit Select
       
       
    End Select
End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.