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