0
我有一个jQuery '切换'功能,我正在使用一个asp.net gridview一起使用的表。我在我的GridView分页,当我点击下一页,它回发,因此关闭切换/表 - 我需要一种保持开放的方式。我有一个类似的问题与手风琴功能过去,但通过此方法解决它,并想知道,如果你们中的一个jQuery的/ JavaScript的天才可以帮助:设置jQuery切换在ASP.Net上打开Gridview Postback
<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
});
谢谢!
不幸的是,没有奏效。谢谢 – James 2011-05-13 10:53:37
你能解释它不工作的方式吗?你有链接,我可以看到在行动? – gbs 2011-05-13 14:22:25
当我点击结果的下一页时,切换器会在发送回发信息时再次关闭。不幸的是,我无法将它显示为它在我的本地机器上运行的唯一方式,我现在无法将它放在活动的服务器上 - 如果有帮助,我粘贴了输出的RAW HTML - http:// pastebin。 com/EbuTPpPx – James 2011-05-13 14:36:02