如何根据列的有界值来选中和取消选中网格中的复选框 [英] How to check and uncheck the checkbox in grid based on bounded value to the column
本文介绍了如何根据列的有界值来选中和取消选中网格中的复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好朋友,
我有网格,其中列Active
具有复选框
Hello Friends,
I have grid, with column Active
which has checkbox
<asp:TemplateField HeaderText="Active" ItemStyle-Width="5" ItemStyle-HorizontalAlign="Center">
<itemtemplate>
<asp:CheckBox ID="chkActive" runat="server" Text="Active" Checked=''<%# (Convert.ToInt32(Eval("active")) == 1)? true: false %>'' />
</itemtemplate>
<edititemtemplate>
<asp:CheckBox ID="chkEActive" runat="server" />
</edititemtemplate>
<itemstyle width="80px" />
我想要的是,当网格加载时,如果活动"的值为1,则选中此复选框,否则未选中.
我试过了
What I wanted, when the grid loads the checkbox gets selected if the value for Active is 1 else unchecked.
I tried
Checked=''<%# (Convert.ToInt32(Eval("Active")) == 1)? true: false %>''
但这会导致表达错误
任何想法,如何获得正确的解决方案?
在此先感谢
But it gives expression error
Any idea, how to get correct solution??
Thanks in advance
推荐答案
你好
从这里寻求帮助
带有扭曲的GridView复选框选择 [在GridView控件中选择多个复选框 [
hello
take help from here
GridView CheckBox Selection With a Twist[^]
or
from here
Selecting multiple checkboxes inside a GridView control[^]
It may help you.
thanks
sanjeev
这篇关于如何根据列的有界值来选中和取消选中网格中的复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文