您好,欢迎来到[编程问答]网站首页   源码下载   电子书籍   软件下载   专题
当前位置:首页 >> 编程问答 >> .NET >> dropdownlist 绑定 怎么在DropDownList中显示"是"或否?

dropdownlist 绑定 怎么在DropDownList中显示"是"或否?

来源:网络整理     时间:2016/8/4 14:39:38     关键词:dropdownlist 绑定

关于网友提出的“dropdownlist 绑定 怎么在DropDownList中显示"是"或否?”问题疑问,本网通过在网上对“dropdownlist 绑定 怎么在DropDownList中显示"是"或否?”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:

问题:dropdownlist 绑定 怎么在DropDownList中显示"是"或否?
描述:

如题,怎样在dropdownlist中显示"是"或"否"?
如婚否这个功能,marry在数据库中的类型为bit,原来我把结果显示在CheckBox中,true值就打钩,false就什么也没有,但我想加上一个打印的功能,当我把打印功能做好后打印出来的checkbox却很模糊,根本分不清是不是打钩了,所以我想用DropDownList绑定数据显示"是","否"!


解决方案1:

if(true) 
dropdownlist1.Text = "是"; 
else 
dropdownlist1.Text = "否";

解决方案2:

啊,错了,应该是:
<%# Convert.ToBoolean(DataBinder.Eval(Container.DataItem, "marry"))==false?"否":"是" %>

解决方案3:

改成模版列,代码为
<%# Convert.ToBoolean(DataBinder.Eval(Container.DataItem, "CallStatus"))==false?"否":"是" %>

解决方案4:

你就在DropDownList的Items中添加两个ListItem,一个是“是”一个是“否”

解决方案5:

那就
if(true)
dropdownlist1.Text = "是";
else
dropdownlist1.Text = "否";
或者
if(true)
dropdownlist1.SelectValue = "是";
else
dropdownlist1.SelectValue = "否";


以上介绍了“dropdownlist 绑定 怎么在DropDownList中显示"是"或否?”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/3104067.html

dropdownlist 绑定相关图片

dropdownlist 绑定相关文章