母版页下拉列表值更改时避免内容页回发
Avoid content page postback when master page dropdownlist value changed
我是 运行 一个 asp.net 应用程序,我有一个母版页和内容页。在母版页中,我在下拉列表中使用更新面板。现在,当我是 运行 应用程序时,当我更改下拉列表值时,第一个内容页面回发事件在该母版页回发事件触发后触发。
下面是我的带下拉列表的母版页更新面板:
<asp:UpdatePanel runat="server" ID="updLOB" UpdateMode="Conditional">
<ContentTemplate>
<asp:DropDownList ID="ddl1" runat="server" OnSelectedIndexChanged="ddl1_SelectedIndexChanged" AutoPostBack="true">
<asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
下拉列表更改时如何避免内容页面回发?
您需要像下面这样设置更新面板的触发源
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddl1" EventName="SelectedIndexChanged" />
</Triggers>
。
这应该嵌入到 <asp:updatepanel>
元素中
<asp:UpdatePanel runat="server" ID="updLOB" UpdateMode="Conditional">
<ContentTemplate>
<asp:DropDownList ID="ddl1" runat="server"
OnSelectedIndexChanged="ddl1_SelectedIndexChanged" AutoPostBack="true">
<asp:DropDownList>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddl1"
EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
我是 运行 一个 asp.net 应用程序,我有一个母版页和内容页。在母版页中,我在下拉列表中使用更新面板。现在,当我是 运行 应用程序时,当我更改下拉列表值时,第一个内容页面回发事件在该母版页回发事件触发后触发。
下面是我的带下拉列表的母版页更新面板:
<asp:UpdatePanel runat="server" ID="updLOB" UpdateMode="Conditional">
<ContentTemplate>
<asp:DropDownList ID="ddl1" runat="server" OnSelectedIndexChanged="ddl1_SelectedIndexChanged" AutoPostBack="true">
<asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
下拉列表更改时如何避免内容页面回发?
您需要像下面这样设置更新面板的触发源
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddl1" EventName="SelectedIndexChanged" />
</Triggers>
。
这应该嵌入到 <asp:updatepanel>
元素中
<asp:UpdatePanel runat="server" ID="updLOB" UpdateMode="Conditional">
<ContentTemplate>
<asp:DropDownList ID="ddl1" runat="server"
OnSelectedIndexChanged="ddl1_SelectedIndexChanged" AutoPostBack="true">
<asp:DropDownList>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddl1"
EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>