【发布时间】:2011-05-12 16:29:27
【问题描述】:
我在与 asp.net gridview 结合使用的表上有一个 jQuery 'toggle' 函数。我的 gridview 有分页,当我点击下一页时,它会发回并因此关闭 Toggle/Table - 我需要一种保持打开状态的方法。过去我在使用 Accordion 函数时遇到过类似的问题,但通过这种方法解决了这个问题,并想知道你们中的一个 jQuery/Javascript 天才是否可以提供帮助:
<asp:HiddenField ID="hidAccordionIndex" runat="server" Value="0" />
<script language="javascript" type="text/javascript">
$(function () {
var activeIndex = parseInt($('#<%=hidAccordionIndex.ClientID %>').val());
$("#accordion").accordion({
autoHeight: false,
event: "mousedown",
active: activeIndex,
change: function (event, ui) {
var index = $(this).children('h3').index(ui.newHeader);
$('#<%=hidAccordionIndex.ClientID %>').val(index);
}
});
});
</script>
<div id="accordion">
<h3><a href="#">Table Header 1 here</a></h3>
<div>
Some text here
</div>
<h3><a href="#">Table Header 2 here</a></h3>
<div>
这是我当前遇到的问题的代码:
<div class="box grid_16 round_all">
<h2 class="box_head grad_colour round_top">Client List</h2>
<a href="#" class="toggle toggle_closed"> </a>
<div class="toggle_container" style="display:none;">
<asp:Label ID="LBLMessage" runat="server" />
<asp:GridView ID="gvClients" runat="server" CssClass="static" AutoGenerateColumns="true" AllowPaging="true" Visible="true" />
</div>
</div>
这里是 jQuery:
// Content Box Toggle Config
$("a.toggle").click(function(){
$(this).toggleClass("toggle_closed").next().slideToggle("slow");
return false; //Prevent the browser jump to the link anchor
});
提前致谢!
【问题讨论】:
标签: javascript jquery asp.net vb.net