社区
C#
帖子详情
DataGrid中判断bit类型列的问题
hypozhong
2007-05-17 04:26:23
ACESS数据库中某列为bit类型,在databind()之后,在IE中显示是true|false
,我现在不想显示两个结果,我想在显示的时候替换true和false,
并显示为“ok”| “NO”
应该怎么办啊?
...全文
233
8
打赏
收藏
DataGrid中判断bit类型列的问题
ACESS数据库中某列为bit类型,在databind()之后,在IE中显示是true|false ,我现在不想显示两个结果,我想在显示的时候替换true和false, 并显示为“ok”| “NO” 应该怎么办啊?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
8 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
self0107
2007-05-24
打赏
举报
回复
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if (e.Item.Cells[i].Text == "ture")
{
e.Item.Cells[i].Text = "Ok";
}
else
{
e.Item.Cells[i].Text = "NO";
}
}
小y的CSDN博客
2007-05-18
打赏
举报
回复
<%# DataBinder.Eval(Container.DataItem, "字段名").ToString()=="true" ? "Yes" : "No"; %>
hypozhong
2007-05-18
打赏
举报
回复
多谢楼上各位指点。
如果我不用模板列和databinder.eval,在databind之前选中那一列做判断呢?
tianke3477
2007-05-17
打赏
举报
回复
同意楼上
刺客
2007-05-17
打赏
举报
回复
amandag(高歌)正解
amandag
2007-05-17
打赏
举报
回复
<%# DataBinder.Eval(Container.DataItem, "字段名").ToString()=="true" ? "Yes" : "No"; %>
zhangliu_521
2007-05-17
打赏
举报
回复
public static string Judgement(bool b)
{
string s = "";
if (b == true)
s = "<b><font color=#009900>ok</font></b>";
else
s = "<b><font color=#FF0000>NO</font></b>";
return s;
}
刺客
2007-05-17
打赏
举报
回复
可以在GRIDVIEW的rowcreate事件里做,判断.
也可以用<%# GetBit(Eval("bit")) %>
在CS里写个GetBit方法
WPF
中
DataGrid
中
的
DataGrid
CheckBoxColumn用法(全选,全否,反选)
WPF
中
DataGrid
中
的
DataGrid
CheckBoxColumn用法(全选,全否,反选) 原文:WPF
中
DataGrid
中
的
DataGrid
CheckBoxColumn用法(全选,全否,反选) 1 前台代码 2 3 <
DataGrid
.Columns> 4 .....
GridView 和
DataGrid
区别
GridView 和
DataGrid
区别 一、GridView和
DataGrid
的异同GridView 是
DataGrid
的后继控件,在.net framework 2
中
,虽然还存在
DataGrid
,但是GridView已经走上了历史的前台,取代
DataGrid
的趋势已是势不可挡。...
GridView和
DataGrid
(转)
一、GridView和
DataGrid
的异同GridView 是
DataGrid
的后继控件,在.net framework 2
中
,虽然还存在
DataGrid
,但是GridView已经走上了历史的前台,取代
DataGrid
的趋势已是势不可挡。GridView和
DataGrid
功能相似,都...
GridView和
DataGrid
的异同
GridView和
DataGrid
的异同 一、GridView和
DataGrid
的异同GridView 是
DataGrid
的后继控件,在.net framework 2
中
,虽然还存在
DataGrid
,但是GridView已经走上了历史的前台,取代
DataGrid
的趋势已是势不可挡。...
类似BOOLEAN
列
的
DATAGRID
TEXTBOX的改进与重写
在这里我们来讲一篇关于如何进行数据
列
内容与显示操作的方法。这种方法类似于实现:有数据表test(id int not null primary key ,name varchar(20) ,sex
bit
), 那么是否有方法不通过直接使用sql语句,如:select id...
C#
110,538
社区成员
642,577
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章