本文介绍了我想在dropwnlist的零元素中显示选择项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我与数据库的dropwnlist绑定时,我想将选择项添加到dropdownlist第零个元素中

i want to add the select item in dropdownlist zero''th element when i dound with that dropwnlist with the database
how it can be possible

推荐答案

ddl.Items.Insert(0, new ListItem("-Select-", "0"));



希望对您有帮助.
并且,如果有帮助,别忘了将其标记为答案. :)



Hope this will help you.
And don''t forget to mark as answer if it helps. :)


<asp:dropdownlist id="DropDownList1" runat="server" width="200px" xmlns:asp="#unknown">
            AppendDataBoundItems="true" DataSourceID="sdsdropdown" DataTextField="Name" 
             DataValueField="Id">
         </asp:dropdownlist>







<asp:SqlDataSource ID="sdsdropdown" runat="server" 

                            ConnectionString="<%
















or

<asp:dropdownlist id="DropDownList1" runat="server" width="200px" xmlns:asp="#unknown">
              DataSourceID="sdsdropdown" DataTextField="Name" 
             DataValueField="Id">
         </asp:dropdownlist>



<asp:sqldatasource id="sdsdropdown" runat="server" connectionstring="<%


这篇关于我想在dropwnlist的零元素中显示选择项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 09:12