且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在数据库表中插入复选框选定的值

更新时间:2022-12-11 20:11:15

你可以通过在提交按钮点击事件中使用foreach循环来实现。

例如:



you can do it by using foreach loop inside submit button click event.
for example :

foreach (GridViewRow r in GVUsers.Rows)
     {

         CheckBox chk = (CheckBox)r.FindControl("checkRow");

         if (chk!=null && chk.Checked)
         {
             //Write your code to insert data of this row into data base..
         }
     }





希望这会对你有帮助。



Hope this will help you.


您可以参考以下链接。



http://www.aspsnippets.com/Articles/Bulk-Edit-Update-Multiple-Rows-in-ASPNet-GridView -using-CheckBoxes.aspx [ ^ ]



希望这有帮助
You can refer the following link for the same .

http://www.aspsnippets.com/Articles/Bulk-Edit-Update-Multiple-Rows-in-ASPNet-GridView-using-CheckBoxes.aspx[^]

Hope this helps