gruber
gruber

Reputation: 29737

ASPxPageControl switching tabs from javascript

I'm trying to use ASPxPageControl ase a template for my wizard. I put buttons on each page and connected it to javascript which simply changes active page, for example:

Pc1Client.SetActiveTab(Pc1Client.GetTab(1));

It works correct when tabs are visible but when I set

ASPxPageControl1.ShowTabs = "false"

then when trying to change tab by clicking my button an error is raised (sth that formant with that name already exists or sth like that, i ve got error message in polish )

Am I doing anything wrong ?

Thanks for help

Upvotes: 2

Views: 8085

Answers (3)

DevExpress Team
DevExpress Team

Reputation: 11376

Here is the code I used (The ASPxPageControl's version is 10.1.6):

<dx:ASPxPageControl ID="ASPxPageControl1" runat="server" ActiveTabIndex="2" ClientInstanceName="pc" EnableClientSideAPI="True">
    <TabPages>
        <dx:TabPage Text="Tab 0">
            <ContentCollection>
                <dx:ContentControl runat="server">
                    0<br />
                </dx:ContentControl>
            </ContentCollection>
        </dx:TabPage>
        <dx:TabPage Text="Tab 1">
            <ContentCollection>
                <dx:ContentControl runat="server">
                    1</dx:ContentControl>
            </ContentCollection>
        </dx:TabPage>
        <dx:TabPage Text="Tab 2">
            <ContentCollection>
                <dx:ContentControl runat="server">
                    2</dx:ContentControl>
            </ContentCollection>
        </dx:TabPage>
    </TabPages>
</dx:ASPxPageControl>
<input type="button" value="click" onclick="pc.SetActiveTab(pc.GetTab(0));" />


protected void Page_Load(object sender, EventArgs e) {
    ASPxPageControl1.ShowTabs = false;
}

It works correctly here.

Upvotes: 2

DevExpress Team
DevExpress Team

Reputation: 11376

To resolve this problem and make your code work, set the ASPxPageControl's EnableClientSideAPI property to true. In this case, everything should work properly.

Upvotes: 1

ajay_whiz
ajay_whiz

Reputation: 17931

That's because when you do ASPxPageControl1.ShowTabs = "false" tabs do not render on page and they are not available through JavaScript

Upvotes: 1

Related Questions