asp.net - Calling Javascript on Client click event of Ajax tab panel - Stack Overflow

admin2025-04-16  0

I want to perform some check after OnClientClick event of Tab Panel in a Javascript function. If my conditions return true I want to allow tab change otherwise want to restrict user on same tab without posting back. PFB code block.

Any help will be great...

<cc1:TabContainer ID="tabContainer" runat="server" AutoPostBack="false"
            BackColor="Red" CssClass="ajax__tab_yuitabview-theme">
            <cc1:TabPanel runat="server" HeaderText="A" ID="tbPrograms" OnClientClick="ClickMe;return false">
                <ContentTemplate>
                    Tab1
                </ContentTemplate>
            </cc1:TabPanel>
            Tab2
<ContentTemplate>
                    <uc2:EmployerResources ID="B" runat="server" />
                </ContentTemplate>
            </cc1:TabPanel>
            Tab3
<ContentTemplate>
                    <uc3:ExternalResources ID="C" runat="server" />
                </ContentTemplate>
            </cc1:TabPanel>
        </cc1:TabContainer>

I want to perform some check after OnClientClick event of Tab Panel in a Javascript function. If my conditions return true I want to allow tab change otherwise want to restrict user on same tab without posting back. PFB code block.

Any help will be great...

<cc1:TabContainer ID="tabContainer" runat="server" AutoPostBack="false"
            BackColor="Red" CssClass="ajax__tab_yuitabview-theme">
            <cc1:TabPanel runat="server" HeaderText="A" ID="tbPrograms" OnClientClick="ClickMe;return false">
                <ContentTemplate>
                    Tab1
                </ContentTemplate>
            </cc1:TabPanel>
            Tab2
<ContentTemplate>
                    <uc2:EmployerResources ID="B" runat="server" />
                </ContentTemplate>
            </cc1:TabPanel>
            Tab3
<ContentTemplate>
                    <uc3:ExternalResources ID="C" runat="server" />
                </ContentTemplate>
            </cc1:TabPanel>
        </cc1:TabContainer>
Share edited Sep 29, 2011 at 8:23 Chat asked Sep 29, 2011 at 6:57 ChatChat 692 gold badges3 silver badges12 bronze badges 2
  • What platform is this? I don't see any JavaScript at all... – beatgammit Commented Sep 29, 2011 at 8:13
  • @tjameson: I have seperate javascript function. I thought their is no need to put that funcation as well here. It has got some logic which will either return True or False at end. It is on windows platform. ASp.Net – Chat Commented Sep 29, 2011 at 8:23
Add a ment  | 

3 Answers 3

Reset to default 2

Give only the name of the javascript function like tabPanel1.OnClientClick="MyJavascriptFunction" and not like this tabPanel1.OnClientClick="MyJavascriptFunction()"

Did you try:

onclientactivetabchanged="ClickMe;return false"

add clickme function in attributes of tab panel

at the loading of page

like

tbPrograms.Attributes.Add("onClick","ClickMe(); return false;");

I hope this will work

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1744809542a268199.html

最新回复(0)