如何避免在图像按钮单击上的选项卡内回发 [英] How can I avoid post back inside a tab on image button click

查看:79
本文介绍了如何避免在图像按钮单击上的选项卡内回发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有4个标签,每个标签内都有一个图像按钮但是当我每次发回第一个活动标签而不是当前标签时点击任何图像按钮



请建议我该怎么做



我尝试过的事情:



我创建了一个id为tabs的div,我在这个div中保留了标签然后我写了一个java脚本代码:



$(function(){

$(#tabs)。tabs();

//在标签更改上设置哈希值

$ ('#tabs ul li a')。click(function(){

location.hash = $(this).attr('href');

}) ;



//在帖子后面维护哈希

$('#<%= Page.Form.ClientID%>') .attr('onsubmit','this.action + = top.location.hash');

})

解决方案

(功能(){

(#tabs)。tabs();

//在标签更改上设置哈希


('#tabs ul li a')。click(function(){

location.hash =


I have 4 tabs and inside each tab I have an Image button but when I click on any Image button every time that post back to the first active tab and not on the current tab

please advice what should i do

What I have tried:

I have created one div with id "tabs" and I kept the tabs inside this div and then I have written a java script code:

$(function () {
$("#tabs").tabs();
// set hash on tab change
$('#tabs ul li a').click(function () {
location.hash = $(this).attr('href');
});

//maintain hash on post back
$('#<%=Page.Form.ClientID%>').attr('onsubmit', 'this.action += top.location.hash');
})

解决方案

(function () {


("#tabs").tabs();
// set hash on tab change


('#tabs ul li a').click(function () {
location.hash =


这篇关于如何避免在图像按钮单击上的选项卡内回发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆