如何在单击中更新数据库中的gridview复选框状态? [英] How to update gridview checkboxes state in database on single click ?

查看:101
本文介绍了如何在单击中更新数据库中的gridview复选框状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我获取数据并绑定到gridview并在此处添加复选框在其他页面中我检索数据并添加到gridview这里我们必须检查复选框多个一个或两个可能是三个这些复选框的状态必须在数据库中更新使用单击。

i试过但我没有找到正确的方法来做这件事



我尝试了什么:



i fetched data and bounded to gridview and checkbox is added here in other page where i retrieved the data and added to gridview here we have to check checkboxes multiple one or two may be three the state of these checkboxes must get updated in database using single click.
i tried but iam not finding the correct way to do it

What I have tried:

 foreach (GridViewRow gridViewRow in GridView2.Rows)
            {
                
            CheckBox  chkSelect = (CheckBox)gridViewRow.FindControl("C");
                id=Convert.ToInt32(GridView2.DataKeys[gridViewRow.RowIndex].Values[0]);

                if (chkSelect.Checked)
                {
}

推荐答案

为什么不是你阅读关于复选框的Microsoft文档? Checked属性也是一个setter,三州有一个枚举。



更多复选框教程。注意处理程序功能。
Why arent you reading the Microsoft documentation on checkboxes? The property Checked is also a setter and the tri-state has a enum.

Some more tutorial on checkboxes. Pay attentention to the handler functions.


这篇关于如何在单击中更新数据库中的gridview复选框状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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