ASP.net:在Gridview中,我想禁用选中的复选框 [英] ASP.net:In Gridview I want to disable checked checkbox

查看:147
本文介绍了ASP.net:在Gridview中,我想禁用选中的复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个gridview控件,

此控件我具有bind复选框,而此复选框具有bind属性,以绑定来自数据库的数据.

我需要禁用所有已选中的复选框.

而且我想轻描淡写地只更改那些不是数据库中真正值的复选框.

简而言之,我需要禁用已选中的复选框.



在此先感谢

Hi,

I have one gridview control,

This control i have bind checkbox and this checkbox have bind property to bind data this come from database.

I need to disable those all checkboxs those are already checked.

and I want give facitlity to change checkbox only those not true value in database.

In short I need to disable checkbox those are checked.



Thanks in advance

推荐答案

尝试
使用Javascript在GridView中相互排斥的复选框 [ ^ ]
如何在GridView中添加互斥复选框 [ ^ ]
Try out
Mutually exclusive checkbox in GridView using Javascript[^]
How To Add Mutually Exclusive CheckBox inside GridView[^]


<asp:GridView ID="grdTemp" runat="server" AllowPaging="True"

           AutoGenerateColumns="False" DataKeyNames="TIME" Height="40px"

           PageSize="8" ShowFooter="True"  >
           <PagerSettings Mode="NumericFirstLast" />
           <RowStyle BackColor="WhiteSmoke" BorderColor="CornflowerBlue" ForeColor="Black"

               Height="30px" />
           <Columns>
               <asp:TemplateField >
                   <ItemTemplate>
                       <asp:CheckBox ID="chkSelect" runat="server" />
                   </ItemTemplate>
               </asp:TemplateField>
               <asp:BoundField DataField="TIME" HeaderText="TIME" /><<pre>FooterStyle BackColor="Silver" Height="25px" />
            <PagerStyle BackColor="DarkGray" />
            <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
        </asp:GridView>




OnCheckedChanged事件写入以下代码




OnCheckedChanged event write the following code

if chk.checked=true then
      chk.enabled=false


这篇关于ASP.net:在Gridview中,我想禁用选中的复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆