当复选框触发时,我的 ASP.NET Accordion 不会以动画方式显示面板更改

发布于 2024-08-30 19:29:15 字数 2121 浏览 4 评论 0原文

我的手风琴面板标记:

<ajaxToolkit:Accordion 
ID="MyAccordion"
runat="server"
SelectedIndex="0"
HeaderCssClass="accordionHeader"
HeaderSelectedCssClass="accordionHeaderSelected"
ContentCssClass="accordionContent"
AutoSize="None"
FadeTransitions="true"
TransitionDuration="250"
FramesPerSecond="40"
RequireOpenedPane="false"
SuppressHeaderPostbacks="true">
<Panes>
    <ajaxToolkit:AccordionPane ID="AccordionPane10" runat="server">
        <Header>BBBBBBBBBB</Header>
        <Content>
        FFFFFFFF:<br /><br />
        <table cellpadding="0" cellspacing="0" width="750"><tr><td width="450" class="verificationtdleft">
            <asp:Image ID="step4_originalimage" runat="server" AlternateText="" />
        </td><td width="300">
            <asp:CheckBox ID="CB_Verification0" runat="server" AutoPostBack="true" /> Verify
        </td></tr>
        </table>
        </Content>

    </ajaxToolkit:AccordionPane>

    <ajaxToolkit:AccordionPane ID="AccordionPane11" runat="server">
        <Header>GGGGGGGGG</Header>
        <Content>
        HHHHHHHHHH:<br /><br />
            <table cellpadding="0" cellspacing="0" width="750"><tr><td width="450" class="verificationtdleft">
                <asp:Image ID="step4_image_thumbnail" runat="server" AlternateText="" />
            </td><td width="300">
                <asp:CheckBox ID="CB_Verification1" runat="server" AutoPostBack="true" /> Verify
            </td></tr>
            </table>
        </Content>
    </ajaxToolkit:AccordionPane>
</Panes>            

以下是我处理复选框检查的方法:

Private Sub CB_Verification0_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CB_Verification0.CheckedChanged
    MyAccordion.SelectedIndex = 1
End Sub

我使面板正确更改,只是它们不像我单击标题时那样动画。当我单击复选框来更改面板时,面板会立即消失,新面板会立即出现,但我希望它能像单击标题一样进行动画处理。有没有办法在强制更改可见面板时导致动画发生?

My accordion panel in markup:

<ajaxToolkit:Accordion 
ID="MyAccordion"
runat="server"
SelectedIndex="0"
HeaderCssClass="accordionHeader"
HeaderSelectedCssClass="accordionHeaderSelected"
ContentCssClass="accordionContent"
AutoSize="None"
FadeTransitions="true"
TransitionDuration="250"
FramesPerSecond="40"
RequireOpenedPane="false"
SuppressHeaderPostbacks="true">
<Panes>
    <ajaxToolkit:AccordionPane ID="AccordionPane10" runat="server">
        <Header>BBBBBBBBBB</Header>
        <Content>
        FFFFFFFF:<br /><br />
        <table cellpadding="0" cellspacing="0" width="750"><tr><td width="450" class="verificationtdleft">
            <asp:Image ID="step4_originalimage" runat="server" AlternateText="" />
        </td><td width="300">
            <asp:CheckBox ID="CB_Verification0" runat="server" AutoPostBack="true" /> Verify
        </td></tr>
        </table>
        </Content>

    </ajaxToolkit:AccordionPane>

    <ajaxToolkit:AccordionPane ID="AccordionPane11" runat="server">
        <Header>GGGGGGGGG</Header>
        <Content>
        HHHHHHHHHH:<br /><br />
            <table cellpadding="0" cellspacing="0" width="750"><tr><td width="450" class="verificationtdleft">
                <asp:Image ID="step4_image_thumbnail" runat="server" AlternateText="" />
            </td><td width="300">
                <asp:CheckBox ID="CB_Verification1" runat="server" AutoPostBack="true" /> Verify
            </td></tr>
            </table>
        </Content>
    </ajaxToolkit:AccordionPane>
</Panes>            

Here's how I handle the checkbox check:

Private Sub CB_Verification0_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CB_Verification0.CheckedChanged
    MyAccordion.SelectedIndex = 1
End Sub

I'm causing the panels to change correctly, it's just that they don't animate like they do when I click the headers. When I click the checkbox to change the panel, the panel just disappears instantly and the new one appears instantly, but I want it to be animated as if I clicked the headers. Is there a way to cause the animation to happen when force changing the visible panel?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

贪了杯 2024-09-06 19:29:15

你可以这样做..所有客户端,你的问题是,当它回发时,它会刷新回第一个..所以你必须关闭自动回发..这是有效的示例..

<script language="javascript" type="text/javascript">

    function toggle(id) {
        var accordion = $get("<%= MyAccordion.ClientID%>");
        accordion.AccordionBehavior.set_SelectedIndex(id);

    }
</script>

    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <ajaxToolkit:Accordion ID="MyAccordion" runat="server" SelectedIndex="0" HeaderCssClass="accordionHeader"
        HeaderSelectedCssClass="accordionHeaderSelected" ContentCssClass="accordionContent"
        AutoSize="None" FadeTransitions="true" TransitionDuration="250" FramesPerSecond="40"
        RequireOpenedPane="false" SuppressHeaderPostbacks="true">
        <Panes>
            <ajaxToolkit:AccordionPane ID="AccordionPane10" runat="server">
                <Header>
                    BBBBBBBBBB</Header>
                <Content>
                    FFFFFFFF:<br />
                    <br />
                    <table cellpadding="0" cellspacing="0" width="750">
                        <tr>
                            <td width="450" class="verificationtdleft">
                                <asp:Image ID="step4_originalimage" runat="server" AlternateText="" />
                            </td>
                            <td width="300">
                                <input id="Checkbox1" type="checkbox" onclick="javascript:toggle(1);" />
                                Verify
                            </td>
                        </tr>
                    </table>
                </Content>
            </ajaxToolkit:AccordionPane>
            <ajaxToolkit:AccordionPane ID="AccordionPane11" runat="server">
                <Header>
                    GGGGGGGGG</Header>
                <Content>
                    HHHHHHHHHH:<br />
                    <br />
                    <table cellpadding="0" cellspacing="0" width="750">
                        <tr>
                            <td width="450" class="verificationtdleft">
                                <asp:Image ID="step4_image_thumbnail" runat="server" AlternateText="" />
                            </td>
                            <td width="300">
                                <input id="Checkbox2" type="checkbox" onclick="javascript:toggle(0);" />
                                Verify
                            </td>
                        </tr>
                    </table>
                </Content>
            </ajaxToolkit:AccordionPane>
        </Panes>
    </ajaxToolkit:Accordion>

You can do this.. all client side, your problem is, when it is posting back, it is refreshing back to first one.. so you have to turn off AutoPost back.. here is sample that works..

<script language="javascript" type="text/javascript">

    function toggle(id) {
        var accordion = $get("<%= MyAccordion.ClientID%>");
        accordion.AccordionBehavior.set_SelectedIndex(id);

    }
</script>

    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <ajaxToolkit:Accordion ID="MyAccordion" runat="server" SelectedIndex="0" HeaderCssClass="accordionHeader"
        HeaderSelectedCssClass="accordionHeaderSelected" ContentCssClass="accordionContent"
        AutoSize="None" FadeTransitions="true" TransitionDuration="250" FramesPerSecond="40"
        RequireOpenedPane="false" SuppressHeaderPostbacks="true">
        <Panes>
            <ajaxToolkit:AccordionPane ID="AccordionPane10" runat="server">
                <Header>
                    BBBBBBBBBB</Header>
                <Content>
                    FFFFFFFF:<br />
                    <br />
                    <table cellpadding="0" cellspacing="0" width="750">
                        <tr>
                            <td width="450" class="verificationtdleft">
                                <asp:Image ID="step4_originalimage" runat="server" AlternateText="" />
                            </td>
                            <td width="300">
                                <input id="Checkbox1" type="checkbox" onclick="javascript:toggle(1);" />
                                Verify
                            </td>
                        </tr>
                    </table>
                </Content>
            </ajaxToolkit:AccordionPane>
            <ajaxToolkit:AccordionPane ID="AccordionPane11" runat="server">
                <Header>
                    GGGGGGGGG</Header>
                <Content>
                    HHHHHHHHHH:<br />
                    <br />
                    <table cellpadding="0" cellspacing="0" width="750">
                        <tr>
                            <td width="450" class="verificationtdleft">
                                <asp:Image ID="step4_image_thumbnail" runat="server" AlternateText="" />
                            </td>
                            <td width="300">
                                <input id="Checkbox2" type="checkbox" onclick="javascript:toggle(0);" />
                                Verify
                            </td>
                        </tr>
                    </table>
                </Content>
            </ajaxToolkit:AccordionPane>
        </Panes>
    </ajaxToolkit:Accordion>
鯉魚旗 2024-09-06 19:29:15

这是因为您正在更改服务器端的面板,因此页面会在面板已展开的情况下发送到客户端。您可以在回发上注册一个脚本来触发客户端的更改。

看看这个博客

This is beacuse you are changing the panel on the server side, so the page is sent to the client with the panel already expanded. You could register a script on your postback to trigger the change on the client side.

Take a look at this Blog

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文