我在UserControl中有这个代码:
ControlloUtente.ascx
<td>
<asp:UpdatePanel ID="up" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddlE" EventName="SelectedIndexChanged" />
</Triggers>
<ContentTemplate>
<asp:DropDownList ID="ddlE" AutoPostBack="true" runat="server" OnSelectedIndexChanged="ddlE_SelectedIndexChanged">
<asp:ListItem Text="Text1" Value="1" Selected="True"></asp:ListItem>
<asp:ListItem Text="Text2" Value="2"></asp:ListItem>
<asp:ListItem Text="Text3" Value="3"></asp:ListItem>
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
</td>
UserControl位于另一个UserControl内:
ListaControlli.ascx
<%@ Register Src="~/BlaBla.ascx" TagName="BlaBla"
TagPrefix="UcBla" %>
<%@ Register Src="~/ControlloUtente.ascx" TagName="ControlloUtente"
TagPrefix="UcCon" %>
<%@ Register Src="~/BlaBla2.ascx" TagName="BlaBla2"
TagPrefix="UcBla2" %>
那是在已经有UpdatePanel的页面中:
Pagina.aspx
<%@ Register Src="~/AltroUserControl.ascx" TagName="AUC" TagPrefix="ucAuc" %>
<%@ Register Src="~/ListaControlli.ascx" TagName="Controlli" TagPrefix="uclControlli" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<asp:UpdatePanel ID="upPagina" runat="server" ChildrenAsTriggers="true">
<ContentTemplate>
(...)
<uclControlli:Controlli ID="ucControlli" runat="server" />
(...)
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="ucAuc" />
</Triggers>
</asp:UpdatePanel>
</asp:Content>
但是更改下拉列表的值我总是有一个完整的回发。有什么问题吗?