在dataitembound事件里面写:
if (e.item.cell[列].text==1)
e.item.cell[列].text="超级管理员"
else if (e.item.cell[列].text==2)
e.item.cell[列].text="超级管理员"
if (e.item.cell[列].text==1)
e.item.cell[列].text="超级管理员"
else if (e.item.cell[列].text==2)
e.item.cell[列].text="超级管理员"
role_id role_name
1 普通管理员
2 超级管理员
查询语句用关联查询,DataGrid中用BoundColumn绑定字段role_name
select case colX when '1' then '超级管理员' when '2' then '普通管理员' else '普通用户' end as colY from tableX where...colX 代表你所说的1,2...缩在的列的列名,根据表中的具体列名而定
colY 代表超级管理员,普通管理员...所在的列的列名,可以随便指定
DataGrid绑定的时候,把colY绑定到你要显示的列上
if (e.item.cell[列].text==1)
e.item.cell[列].text="超级管理员"
else if (e.item.cell[列].text==2)
e.item.cell[列].text="超级管理员"为什么我用这个方法判断不出来if(e.Item.Cells[2].ToString()=="1")
e.Item.Cells[2].Text="超级管理员";
else
e.Item.Cells[2].Text="普通管理员";