开发者

ASPxPageControl switching tabs from javascript

I'm trying to use ASPxPageControl ase a template for my wizard. I put buttons on each page a开发者_StackOverflow中文版nd 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


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.


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜