dataGridView复选框 [英] dataGridView checkbox

查看:141
本文介绍了dataGridView复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在设置dataGridView1.DataSource之后,谁知道如何在dataGridView中设置复选框列?

Anybody knows how to set up checkbox column in a dataGridView, after setting the dataGridView1.DataSource?

首先,datagridview没有任何列,因此在设置dataSource之后,它将自动创建列,但是我不知道如何自动将列设置为复选框类型.

At first the datagridview does not have any column, so after setting the dataSource it will create column automatically, but I don''t know how to automatically set the column to be checkbox type.

谢谢

推荐答案

查看第一个结果:
http://lmgtfy.com/?q=asp.net+checkbox+gridview

另外,您的问题可能是您正在自动生成列.将其设置为false,然后手动创建您的列.在这里查看更多信息:

Also, your problem is probably that you are autogenerating columns. Set it to false then create your columns manually. Look here for more information:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.autogeneratecolumns.aspx

另外,请查看:

http://www.codeproject.com/KB/webforms/CheckBoxCommand.aspx


首先,转到datagridview列属性并进行设置将列类型添加到datagridviewcheckboxcolumn,将其复选框列添加到您的datagrid视图中,然后根据需要添加行,您可以使用它来添加行. DataGridview1.Rows.Add(行数); //例如(5)
First , Go to the datagridview column property and set the columntype to datagridviewcheckboxcolumn it adds the checkbox columns in to ur datagrid view,then add Rows as per u required u can use it for adding Rows--> DataGridview1.Rows.Add(no. of rows); //e.g (5)


这篇关于dataGridView复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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