日期:2014-05-17  浏览次数:20453 次

updatepanel repeater drownlist 不能局部刷新

<form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:Repeater ID="Repeater1" runat="server">
                    <ItemTemplate>
                        <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
                            <asp:ListItem Value="1">aaaaaa</asp:ListItem>
                            <asp:ListItem Value="12">ccccccc</asp:ListItem>
                            <asp:ListItem Value="13">bbbbbb</asp:ListItem>
                        </asp:DropDownList>
                        <asp:Button ID="Button1" runat="server" Text="Button" />
                        <br />
                        <br />
                    </ItemTemplate>
                </asp:Repeater>
            </ContentTemplate>
        </asp:UpdatePanel>
    </form>

updatepanel 套 repeater
repeater 里面 有button 和 dropdownlist
button 可以局部刷新,但是dropdownlist会导致页面刷新,大家试过没有?

------解决方案--------------------
http://bbs.csdn.net/topics/390631332

注意,首先,我写了“UpdateMode="Conditional"”。
------解决方案--------------------
http://msdn.microsoft.com/zh-cn/library/system.web.ui.scriptmanager.registerasyncpostbackcontrol(v=vs.110).aspx

ScriptManager.RegisterAsyncPostBackControl 方法 
将控件注册为异步回发的触发器。