C#网格视图问题 [英] C# Grid View Problem

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

问题描述

如何在网格视图中添加复选框,然后仅通过网格视图本身中的删除按钮删除选中的项目

How to add a check box in a grid view and then delete the checked items only through a delete button in the grid view itself

推荐答案

添加控件:
To add the Control :
CheckBox cb=new CheckBox();
cb.ID="myCb";
gv.Rows[0].Cells[0].Controls.add(cb);


删除复选框:


to remove the checkbox:

CheckBox cb=new CheckBox();
cb=gv.Rows[0].Cells[0].FindControl("myCon") as CheckBox;
gv.Rows[0].Cells[0].Controls.Remove((Control)cb);


您是指ASP.NET还是Winforms?无论哪种方式,网络上都有大量的示例,您尝试了什么?

Do you mean in ASP.NET or winforms ? Either way, there''s tons of examples on the web, what have you tried ?


该链接可能会使您非常困惑,-
http://www.asp.net/data-access/tutorials/adding-a-gridview-column-of-checkboxes-vb [
May be this link halp you very much,-
http://www.asp.net/data-access/tutorials/adding-a-gridview-column-of-checkboxes-vb[^]


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

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