基于布尔数据库值显示的自定义文本
问题描述:
我在数据库中有bit列,并将其与显示为true或false的标签绑定在一起.我想显示为已接受还是未接受
感谢
I have bit column in the database and bind it with label it displayed true or false I want to be displayed as accepted or not accepted
thanks
答
我该怎么做是一种无用的主题行选择.
您是否会使用可基于变量状态设置标签文本的代码(可能使用条件运算符,例如<%=((bool)Eval("myCol")))来执行此操作? "Accepted":不接受"; %> ;,假设它在某种网格的模板定义中.
这是一个非常基本的问题,如果您正在为某个班级做一些事情(没有任何级别的我认为接受代码报酬是很合理的),那么您应该有一个当然要参考这本书?
How can I do is kind of a useless subject line choice.
You''d do this with code that sets the label text based on the state of the variable, perhaps using the conditional operator, something like <%= ((bool)Eval("myCol")) ? "Accepted" : "Not Accepted"; %>, assuming it''s in a template definition for some sort of grid.
This is a pretty basic question, if you are working on something for a class ( there''s no level on which I''d accept it as remotely reasonable that you''re being paid to code ), then you should have a book to refer to, surely ?