用DataGrid绑定数据库后如何显示自定义内容? 在DataGrid中有几个BoundColumn绑定到一个数据表里的字段,其中有一个字段名status的值是1或者2,那么在页面相应DataGrid中也会显示1或2,但是我希望如果是1那么显示“连接”,如果是2那么显示“断开”,请问怎么做? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在Item_DataBound中写if(e.Item.Cells[你要显示列的序号].Text=="1"){ e.Item.Cells[你要显示列的序号].Text="连接";}else{ e.Item.Cells[你要显示列的序号].Text="断开";} select case columnname when '1' then '连接' when '2' then '断开' end as columnname from tablename 在数据源上转换(数据库中)select case status when '1' then '连接' when '2' then '断开' end as 状态 from yourtable然后 用字段 “状态”绑定grid列 对,用楼上的sql直接语句转换。如果用的是oracle的存储过程,可用decode转换 在哪里写,写到Page_Load函数里吗??? datagridview标题问题 导出excel在2007中提示“文件类型与扩展名不同的对话框” 找不到资料 为什么SelectParameters参数方式不对。 孟子进~(顶者有分) 如何在.net页面中指定iframe中的文件地址 错误:无法从web上获取项目文件,哪位指点下,先谢了 数据更新后显示错误问题 请教自定义事件问题 请问MSN网络硬盘的容量是多少? 放置用户控件在vs.net里有简单的方法吗? 请各位帮忙,简单的return confirm问题。谢谢了。
if(e.Item.Cells[你要显示列的序号].Text=="1")
{
e.Item.Cells[你要显示列的序号].Text="连接";
}
else
{
e.Item.Cells[你要显示列的序号].Text="断开";
}
when '2' then '断开'
end as columnname from tablename
select case status when '1' then '连接'
when '2' then '断开'
end as 状态 from yourtable
然后 用字段 “状态”绑定grid列
如果用的是oracle的存储过程,可用decode转换