FormView控件下DropDownList是否可以绑定

在网站下,FormView控件下是可以通过绑定DropDownList的SelectedValue属性来绑定字段来显示

举例:

 1 <asp:DropDownList ID="cboUnion" runat="server" AppendDataBoundItems="True"
 2 DataSourceID="sdsUnion" DataTextField="UnionName" DataValueField="U_id"
 3 SelectedValue='<%#Bind("U_id") %>'>
 4 <asp:ListItem Value="-1" Selected="True">-请选择-</asp:ListItem>
 5 </asp:DropDownList>
 6 
 7 
 8 
 9 <asp:SqlDataSource ID="sdsUnion" runat="server" ConnectionString="<%$ ConnectionStrings:AppConnStr %>" SelectCommand="SELECT U_id,U_name, '【' + U_type + '】' + U_name AS UnionName FROM [Union] 
10 where ('0'=@IsSubUnion or U_id = @UID)
11 ORDER BY UnionName">
12 <SelectParameters>
13 <asp:ControlParameter ControlID="txtIsSubUnion" Name="IsSubUnion" PropertyName="Value" />
14 <asp:ControlParameter ControlID="txtUnionId" Name="UID" PropertyName="Value" />
15 </SelectParameters>
16 </asp:SqlDataSource>
原文地址:https://www.cnblogs.com/dianyitongxiao/p/3242887.html