里面的UpdatePanel的CheckBoxList触发,当一个项目被选中完全回发 [英] Checkboxlist inside UpdatePanel triggers full postback when an item is checked

查看:145
本文介绍了里面的UpdatePanel的CheckBoxList触发,当一个项目被选中完全回发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有这样的CheckBoxList,我想实现全选功能为它里面的元素。我把它放在一个UpdatePanel里面,但每次我点击一个项目,整个页面重新加载。这是我的code:

So I have this Checkboxlist and I want to implement a Select All feature for the elements inside it. I placed it inside an UpdatePanel, but everytime I click an item, the entire page is reloaded. This is my code:

 <asp:UpdatePanel ID="CBLPanel" runat="server" UpdateMode="Conditional"     ChildrenAsTriggers="false">
            <ContentTemplate>
                <div class="LeftAligned">
                    <asp:Label ID="FilterLabel" runat="server" Text="Filter by:" />
                    <asp:DropDownList runat="server" ID="FilterDDL" AutoPostBack="true" OnSelectedIndexChanged="FilterDDL_SelectedIndexChanged" />
                    <asp:ImageButton ID="FB" runat="server" ImageUrl="~/images/filter.png" AlternateText="VALUE"
                        CssClass="filter_button" OnClick="FB_Click" />
                    <div onmouseout="javascript:bMouseOver=false;" onmouseover="javascript:bMouseOver=true;"
                        class="filter_div">
                        <asp:CheckBoxList AutoPostBack="true" ID="FilterCheckBoxList" ClientIDMode="Static"
                            runat="server" CssClass="filter_checklist collapsed" OnSelectedIndexChanged="FilterCheckBoxList_Selected">
                        </asp:CheckBoxList>
                    </div>
                </div>
            </ContentTemplate>
                    </asp:UpdatePanel>

不过,我觉得我应该设置ChildrenAsTriggers为false,这样我就从code只更新,但它似乎并没有工作。

I though I should set ChildrenAsTriggers to false and this way I would update only from the code, but it doesn't seem to work.

推荐答案

这看起来像一个熟悉的.NET的Bug。在设置的CheckBoxList =的ClientIDMode汽车应该修复它。

This looks like a familiar .NET Bug. Setting ClientIDMode=Auto on the CheckBoxList should fix it

这篇关于里面的UpdatePanel的CheckBoxList触发,当一个项目被选中完全回发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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