问题描述
我有一个具有ImageButton的一列。我的数据库字段位
数据类型。我想,当我记录在该列中展现了真正的价值 True.jpg
和我的命令成为 MakeFalse
键,当它有假值显示 False.jpg
和我的命令成为 MakeTrue
。我怎样才能做到这一点?是否有可能与一个模板列
?
I have a column that has an ImageButton. my database field has bit
data type. I want when my record has true value in that column show True.jpg
and my command become MakeFalse
and when it has false value show False.jpg
and my command become MakeTrue
. How I can do this?Is it possible to do it with one TemplateField
?
感谢
推荐答案
您可以包括在模板列
双ImageButtons并从<$ C $评估可见C> bit_field
You could include two ImageButtons in a TemplateField
and evaluate Visible from your bit_field
<asp:TemplateField HeaderText="YourField">
<ItemTemplate>
<asp:ImageButton runat="server" ImageUrl="True.jpg" Visible='<%# (bool)Eval("bit_field") %>' />
<asp:ImageButton runat="server" ImageUrl="False.jpg" Visible='<%# !(bool)Eval("bit_field") %>' />
</ItemTemplate>
</asp:TemplateField>
我不知道你怎么想的司令部,以配合。
I'm not sure how you'd want your Command to tie in.
这篇关于如何更改模板列命令文本和ItemTemplate中的的ImageButton的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!