我如何找到选中的gridview复选框 [英] how can i find gridview checkbox selected or not

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

问题描述

大家好.......

我使用mysql作为数据源,并在网格视图中添加了一张表,还添加了复选框作为项目模板,这里的问题是我需要找到选中的一个和未选中的复选框,请问有谁可以帮助我





在此先感谢

解决方案

我想首先您需要访问复选框,使用此类似代码只需更改名称

标签lbl = DataList1.Items [0] .FindControl("Label14")作为标签;


与if(checkbox.selected)相比,对每个复选框都尝试一下.使用findControl从当前行获取复选框控件.找到后,检查已检查"值.在此基础上,您可以编写逻辑.试试吧!


hi all.......

i used mysql as datasource and i added one table to grid view and also added check box as item template here my problem is i need to find which one is selected and which check box is not selected can any one please help me





thanks in advance

解决方案

i guess first you need to access to checkboxes use this similar code just change names

Label lbl = DataList1.Items[0].FindControl("Label14") as Label;


try this one for each checkbox than do the if(checkbox.selected)


Lets say on a button click event, just loop though the grid rows. Use findControl to get the checkbox control from current row. Once found, check for the ''checked'' value. Based on it, you can write your logic. Try!


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

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