在 Ajax 选项卡面板的客户端单击事件上调用 Javascript
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7593564/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Calling Javascript on Client click event of Ajax tab panel
提问by Chat
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.
我想在 Javascript 函数中的 Tab Panel 的 OnClientClick 事件之后执行一些检查。如果我的条件返回 true,我想允许选项卡更改,否则想将用户限制在同一选项卡上而不回发。PFB 代码块。
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>
回答by Abdul Rauf
Give only the name of the javascript function like tabPanel1.OnClientClick="MyJavascriptFunction" and not like this tabPanel1.OnClientClick="MyJavascriptFunction()"
只给出 javascript 函数的名称,如 tabPanel1.OnClientClick="MyJavascriptFunction" 而不是像这样 tabPanel1.OnClientClick=" MyJavascriptFunction()"
回答by Andrew
Did you try:
你试过了吗:
onclientactivetabchanged="ClickMe;return false"
回答by Fahad Hussain
add clickme function in attributes of tab panel
在选项卡面板的属性中添加 clickme 功能
at the loading of page
在页面加载时
like
喜欢
tbPrograms.Attributes.Add("onClick","ClickMe(); return false;");
I hope this will work
我希望这会奏效