读书人

DropDownList 手动添加的 ListItem项目

发布时间: 2013-09-25 11:02:59 作者: rapoo

DropDownList 手动添加的 ListItem项目 怎么不显示?(已经绑定数据源)
以下是源码:


<asp:DropDownList ID="XianMing" runat="server" DataSourceID="XianMingSqlData"
DataTextField="xianMing" DataValueField="xianMing" CssClass="XiaLaKuang">
<asp:ListItem Text="------请选择------" Value="" Selected="True"></asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="XianMingSqlData" runat="server"
ConnectionString="<%$ ConnectionStrings:JianKongConnectionString %>"
SelectCommand="SELECT DISTINCT [xianMing] FROM [XianMing]">
</asp:SqlDataSource>


“------请选择------”那一项始终都不显示!!怎样才能显示出来! dropdownlist 数据 select html
[解决办法]
<asp:DropDownList ID="ddlli" runat="server" AutoPostBack="true" AppendDataBoundItems="true">

[解决办法]
AppendDataBoundItems="true"
[解决办法]
Refer this:
http://www.cnblogs.com/insus/archive/2011/11/17/2252372.html

see also:
http://www.cnblogs.com/insus/archive/2013/01/15/2861536.html
http://www.cnblogs.com/insus/archive/2011/11/08/2241255.html
------解决方案--------------------


引用:
AppendDataBoundItems="true"


应该是这个。

读书人网 >asp.net

热点推荐