在我的页面上,我有一个DropDownList用数据库值填充的SqlDataSource(参见下面的代码).
如何在值之前添加自己的文本或空行?
<asp:DropDownList ID="drpClient" runat="server" Width="200px"
AutoPostBack="True" DataSourceID="dsClients" DataTextField="name"
DataValueField="client_id">
</asp:DropDownList>
<asp:SqlDataSource ID="dsClients" runat="server"
ConnectionString="my_connection_string"
ProviderName="System.Data.SqlClient"
SelectCommand="SELECT [client_id], [name] FROM [clients]">
</asp:SqlDataSource>
Run Code Online (Sandbox Code Playgroud)
谢谢.
PS你建议使用SqlDataSource或者更好地填充另一种方式吗?