入住后两端的反向电流jQuery的标签? [英] Staying on current jQuery tab across post back?
问题描述
我使用jQuery的标签和一个ASP.NET列表视图来显示和编辑的一些信息。我的问题是,当用户在ListView项目之一插入一个新的记录我的jQuery标签回到第一个标签。有没有一种方法来跟踪我或保持它搁在回发的选项卡?
I am using jQuery tabs and an ASP.NET listview to display and edit some information. My problem is that when a user inserts a new record in one of the listview items my jQuery tabs go back to the first tab. Is there a way to keep track of which tab I am on or keep it from resting on post back?
推荐答案
在asp.net你可以在一个隐藏字段其存储,而无需使用Cookie(不需要jQuery的饼干参考)。
In asp.net you can store it in a hidden field without having to use a cookie (no need for the jquery cookie reference).
使用这样的:
$(function () {
$("#tabs").tabs({
activate: function() {
var selectedTab = $('#tabs').tabs('option', 'active');
$("#<%= hdnSelectedTab.ClientID %>").val(selectedTab);
},
active: <%= hdnSelectedTab.Value %>
});
});
然后在体内,声明你的隐藏选项卡字段:
Then in the body, declare your hidden tab field:
<asp:HiddenField ID="hdnSelectedTab" runat="server" Value="0" />
基本上,一个标签选择您要存储在ASP隐藏字段选择标签值。然后在节目要检索的值。
Basically, on selection of a tab you are storing the selected tabs value in the asp hidden field. Then on show you are retrieving the value.
这篇关于入住后两端的反向电流jQuery的标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!