Using the following markup, my details view is not populating when the dropdown is selected. where 参数的 id 来自 dropdwon 选择的值。看来控制参数没有正常工作。
<asp:UpdatePanel ID="updtEditContact" runat="server">
<ContentTemplate>
<asp:DropDownList ID="ddlContacttoEdit" runat="server" CssClass="dropdowns"
AutoPostBack="True" ClientIDMode="Static"/>
<asp:DetailsView ID="dvEditContacts" runat="server" Height="50px" Width="125px"
AutoGenerateEditButton="True" CssClass="mGrid"/>
<asp:EntityDataSource ID="edsSelectedContact" runat="server" ConnectionString="name=webEntities"
DefaultContainerName="webEntities" EnableFlattening="False"
EntitySetName="contacts">
<WhereParameters>
<asp:ControlParameter ControlID="ddlContactToEdit" Name="Id"
PropertyName="SelectedValue" Type="Int32" />
</WhereParameters>
</asp:EntityDataSource>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="rblAddEditContact" EventName="SelectedIndexChanged"/>
<asp:AsyncPostBackTrigger ControlID="ddlContacttoEdit" EventName="SelectedIndexChanged"/>
</Triggers>
</asp:UpdatePanel>