DropDownList导致UpdatePanel(Inside Repeater)中的整页回发 [英] DropDownList is causing full page post back in UpdatePanel (Inside Repeater)

查看:81
本文介绍了DropDownList导致UpdatePanel(Inside Repeater)中的整页回发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为AddressEdit的用户控件,它在更新面板中包含两个下拉列表框,如下所示:



I have a user control called AddressEdit, that contains two drop down list boxes inside a update panel like this:

<asp:UpdatePanel ID="upCountry" runat="server" >
    <ContentTemplate>
   <tr class="row">
            <td class="item-name">
                <%#GetLocaleResourceString("Account.Country")%>:
            </td>
            <td class="item-value">
                <asp:DropDownList ID="ddlCountry1" AutoPostBack="true" runat="server"  OnSelectedIndexChanged="ddlCountry1_SelectedIndexChanged"

                    Width="137px">
                </asp:DropDownList>
            </td>
        </tr>

        <tr class="row">
            <td class="item-name">
                <%#GetLocaleResourceString("Account.StateProvince")%>:
            </td>
            <td class="item-value">
                <asp:DropDownList ID="ddlStateProvince1" AutoPostBack="False" runat="server" Width="137px">
                </asp:DropDownList>
            </td>
        </tr>
   </ContentTemplate>
</asp:UpdatePanel>





我我在转发器中使用此用户控件。





And I am using this user control in a repeater.

<asp:Repeater ID="rptrBillingAddresses" runat="server">
            <ItemTemplate>
                <div class="address-item">
                    <CtrlAddressDispla:AddressDisplay ID="BillingAddresses" runat="server" Address='<%# Container.DataItem %>'

                        ShowEditButton="true" ShowDeleteButton="true" />
                </div>
            </ItemTemplate>
            <SeparatorTemplate>
                <div class="clear">
                </div>
            </SeparatorTemplate>
        </asp:Repeater>







现在的问题是,每当我在 ddlCountry 中改变国家时,它会导致整页回发而不是部分回发。



如何解决这个问题?




Now problem is that, whenever I change country in ddlCountry its causing full page post back instead of partial postback.

How to resolve this problem?

推荐答案

查看此博客

http://stackoverflow.com/questions/2138565/drop -down-list-in-update-panel-caused-full-postback [ ^ ]

--NDK
check this blog
http://stackoverflow.com/questions/2138565/drop-down-list-in-update-panel-causing-full-postback[^]
--NDK


没有看到代码为您的 ScriptManager 我不能100%确定,但我认为你需要在 ScriptManager 上设置 EnablePartialRendering true:



http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.enablepartialrendering.aspx [ ^ ]
Without seeing the code for your ScriptManager I can't be 100% sure but I think you need to set EnablePartialRendering on the ScriptManager to true:

http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.enablepartialrendering.aspx[^]


add ClientIDMode = AutoID到您的下拉列表或页面属性
add ClientIDMode="AutoID" to your dropdownlist or in page attribute


这篇关于DropDownList导致UpdatePanel(Inside Repeater)中的整页回发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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