我在 DetailsView 中有一个 DropDownList 作为 TemplateField。我想使用将从一个 SqlDataSource 中提取的所有可能选项填充此 DropDownList,同时将 DropDownList 的选定值分配给来自 DetailsView 绑定到的 SqlDataSource 的当前值。所以像:
<asp:DetailsView DataSourceID="SqlDataSource1">
<asp:TemplateField>
<asp:DropDownList ID="Serial">
/* Here is where I need to bind the dropdown to data source 2 so that All serials are available while selecting it's current value from data source 1.
</asp:TemplateField>
</asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSource1"
SelectCommand = "Select SerialNumber From Equipment Where EquipID = @EquipID">
<SelectParameters>
<asp:ControlParameter ControlID="GridView1" DefaultValue=""
Name="EquipID" PropertyName="SelectedDataKey.Values[EquipID]" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2"
SelectCommand = "Select SerialNumber From Equipment">
</asp:SqlDataSource>