网格视图中的复选框 [英] Checkbox in gridview

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

问题描述

朋友,

在这里,我需要一个解决方案来选择通过c#而不是通过向导进行的急剧编码来绑定到数据库的gridview中的行,请zzzz帮助我.

hi friends,

here i need a solution to select a rows in a gridview which is bind to database by c# sharp coding not by wizard, plzz help me out guys.

推荐答案

尝试一下代码,它将在您的数据网格视图中为Checkbox创建新列.
Try this code it creates new column for Checkbox in your DataGrid View.
DataGridViewButtonColumn chkbox = new DataGridViewButtonColumn();
chkbox.HeaderText = "Select Row";
chkbox.UseColumnTextForButtonValue = true;
dataGridView1.Columns.Add(chkbox);


之后,您可以对复选框选择进行编码以选择一行DataGridView.


After that you can code on checkbox selection to select a row of DataGridView.


如果需要在gridview中添加复选框,请执行ff:

If you need to add a checkbox in your gridview, do the ff:

<asp:templatefield itemstyle-width="10px" xmlns:asp="#unknown">
                        <HeaderTemplate>
                            <asp:checkbox id="chkAllItem" runat="server" />
                        </HeaderTemplate>
                        <itemtemplate>
                            <asp:checkbox runat="server" id="chkItem" />
                        </itemtemplate>
                        <itemstyle width="10px" />
                    </asp:templatefield>



如果仍不能解决您的问题,请通知我.

问候,
爱德华



If this doesn''t answer your question, please let me know.

Regards,
Eduard


试试这个
在ASP.NET GridView控件中使用复选框
try this
Using Checkbox in ASP.NET GridView Control


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

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