如何强制关闭jQuery UI的手风琴与LT; D​​IV>以< ASP:按钮&GT ;? [英] How to force close jQuery UI accordion <DIV> with <asp:button>?

查看:112
本文介绍了如何强制关闭jQuery UI的手风琴与LT; D​​IV>以< ASP:按钮&GT ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用jQuery UI的手风琴与两个div。所述第一显示形式和基于表单的输入端的第二显示数据。我如何自动关闭第一个div和显示第二,当用户点击表单提交按钮?我假设我需要在按钮使用的onclick',但我不知道如何与手风琴扎进去。

I'm using the jQuery UI accordion with two divs. The first displays a form and the second shows data based on the input of the form. How do I auto close the first div and display the second when a user clicks the submit button in the form? I'm assuming I need to use 'onclick' in the button, but I'm not sure how to tie it in with the accordion.

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<script type="text/jscript">
$(document).ready(function () {
$("#accordion").accordion();
});
</script>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<div id="accordion">
<a href="#">Criteria</a>
<div>
<asp:Button ID="Button_GetReport" runat="server" Text="View Report" />
</div>
<a href="#">Report</a>
<div>
A databound grid goes here.
</div>
</div>
</asp:Content>

如果我留下了什么,让我知道。在此先感谢您的帮助!

If I left anything out, let me know. Thanks in advance for any help!

推荐答案

点击提交按钮会往返于服务器,所以的onclick是不会帮你的。你可能要输出的手风琴是否应该打开或关闭。

Clicking the submit button would roundtrip to the server, so onclick isn't going to help you. You'll probably want to output whether the accordion should be opened or closed.

这样做会改变你的手风琴div来有一个显示状态一类的一种方式:

One way to do that would be to change your accordion div to have a class showing the state:

<div id="accordion" class="accordion-<%= accordion_state %>"> //open or closed

那么你的选择是:

Then your selector would be:

$(document).ready(function () {
  $(".accordion_open").accordion();
  $(".accordion_closed").hide();
});

请参阅 使用ASP.NET和手风琴一起控制的一些例子。

See this article for some examples of using ASP.NET and the accordion control together.

这篇关于如何强制关闭jQuery UI的手风琴与LT; D​​IV&GT;以&lt; ASP:按钮&GT ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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