我在一個頁面上有十個DropDownList。當我爲所有人使用相同的數據源時,所有十個值都有重複值。是否有一種方法可以爲所有十個DropDownList使用一個SqlDataSource,並且只爲每個DropDownList獲取不同的值。來自一個SqlDataSource的DropDownList的不同值
這是一個例子下拉列表和SqlDataSource的:
<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1" DataTextField="County" DataValueField="County"AppendDataBoundItems="true"></asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings %>"
SelectCommand="SELECT Distinct * FROM [Personal]"></asp:SqlDataSource>
在此先感謝
是否每個下拉列表有不同的DataTextField和DataValueField界定? – JCherryhomes 2012-04-10 02:20:21
是的每個dropDownList將有不同的DataTextField和DataValueField,謝謝 – user973671 2012-04-10 02:29:41