我有以下代码。
我想要的是当 ddlProvince 下拉列表更改时,抛出事件 SelectedIndexChanged,但是该方法永远不会被访问。
<asp:UpdatePanel ID="pnlCountries" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddlProvince" EventName="SelectedIndexChanged" />
</Triggers>
<ContentTemplate>
<tr>
<td><asp:Literal ID="Literal37" Text="<%$Resources:glossary,country %>" runat="server"/></td>
<td>
<asp:DropDownList ID="ddlCountries" CssClass="textbox" runat="server">
</asp:DropDownList>
<br />
<cc1:cascadingdropdown ID="cddCountries" runat="server" Category="Country" Enabled="True" LoadingText="<%$Resources:Glossary,loading %>" PromptText="<%$Resources:Glossary,country_choose %>"
ServiceMethod="GetCountries" TargetControlID="ddlCountries">
</cc1:cascadingdropdown>
<asp:RequiredFieldValidator CssClass="errortext" Text="<%$Resources:Glossary,required %>" SetFocusOnError="true" ID="rfvcboScenario" runat="server" InitialValue="" ControlToValidate="ddlCountries" Display="Dynamic" />
</td>
</tr>
<tr>
<td><strong><asp:Literal ID="Literal9" Text="<%$Resources:Glossary,province %>" runat="server" /> *</strong></td>
<td>
<asp:DropDownList ID="ddlProvince" CssClass="textbox" runat="server">
</asp:DropDownList>
<asp:RequiredFieldValidator CssClass="errortext" Text="<%$Resources:Glossary,required %>" SetFocusOnError="true" ID="RequiredFieldValidator1" runat="server" InitialValue="" ControlToValidate="ddlProvince" Display="Dynamic" />
<cc1:CascadingDropDown ID="cddProvince" runat="server" TargetControlID="ddlProvince" ParentControlID="ddlCountries"
Category="Province" LoadingText="<%$Resources:Glossary,loading %>" prompttext="<%$Resources:Glossary,province_select %>" ServiceMethod="GetProvincesForCountry" >
</cc1:CascadingDropDown>
</td>
</tr>
</ContentTemplate>
</asp:UpdatePanel>
目前,此代码行从未被击中:
Protected Sub ddlProvince_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ddlProvince.SelectedIndexChanged
ReportError("ddlProvince_SelectedIndexChanged", "")
End Sub
更新:以前我在 ddlProvince 控件上有 Autopostback="true" 属性,但是,这导致了完整的回发(这里也描述了问题:下拉列表(在更新面板中)导致完整的回发!)
我错过了什么?