C#datagridview复选框

编程入门 行业动态 更新时间:2024-10-16 20:31:40
本文介绍了C#datagridview复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在将DataGridview与checkbox colum一起使用.我可以将数据从datagridview与checkbox colum一起插入数据库中. 但是我已经从数据库中读取了数据到复选框(我的意思是我需要选中复选框以检查特定的数据库记录值).我们如何做到这一点请帮助我............

I am using DataGridview with checkbox colum.I can Insert data to database from datagridview with checkbox colum. But i have read data from database to checkbox(i mean i need checkbox as checked for particular database record value).how can we do this please help me............

推荐答案

代表复选框的数据值需要作为布尔值进行管理. 您可以使用datagridviewcheckboxcolumn的选定状态并将其转换为布尔值,同时保存在数据库中. The data value which represents checkbox need to be managed as a boolean value. you can use selected state of the datagridviewcheckboxcolumn and convert it into boolean value while saving in the DB.

<asp:templatefield headertext="CheckBox" itemstyle-horizontalalign="Center" xmlns:asp="#unknown"> <itemtemplate> <asp:checkbox id="Chk1" runat="server" checked="<%#Eval("Check") %>" /> </itemtemplate> </asp:templatefield>

"Check" is the field name which we select from the database and that field in database shoult be bit

更多推荐

C#datagridview复选框

本文发布于:2023-11-10 16:22:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1575878.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:复选框   datagridview

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!