我在gridview中有一个dropdownlist,并在代码中为dropdownlist绑定了网格视图。问题是dropdownlist在edittemplate中,当行不在编辑时,当是dropdownlist时,所选值是同一单元格中的id。
编辑空值时如何显示?
发布于 2010-04-29 04:48:09
在下拉列表中添加一个表示空值的项。
<asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Bind("CurrencyType") %>' AppendDataBoundItems="true">
<asp:ListItem Value="">Not selected</asp:ListItem>
</asp:DropDownList>发布于 2013-08-26 16:33:42
您可以放置您的业务逻辑并检查所选值是否不为空,然后您可以使用在选择时将符号化为空的数据项。
<asp:DropDownList ID="ddlitems" runat="server" SelectedValue='<%# Bind("mydata") %>' AppendDataBoundItems="true">
<asp:ListItem Value="">select</asp:ListItem>
</asp:DropDownList>https://stackoverflow.com/questions/2732061
复制相似问题