Gridview中的CheckBoxList [英] CheckBoxList in Gridview

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

问题描述

我一直试图找出如何在gridview的每一行上具有全选"按钮,该按钮将使用javascript或jquery仅选择该行上的所有复选框.我已经看到了很多方法来选择gridview中的所有复选框,但是我只想选择单击全选"按钮的行上的那些复选框.任何想法将不胜感激.

jp

I have been trying to figure out how to have a "select all" button on each row of a gridview that will using javascript or jquery select all of the check boxes on that row only. I have seen many ways to select all of the check boxes in a gridview but I want to only select those check boxes on the row that the "select all" button was clicked. Any ideas would be appreciated.

jp

推荐答案

检查以下链接:

http://blog.divergencehosting.com/2010/01/14/adding-a-check-all-box-to-check-checkboxes-within-a-row-in-a-gridview/ [ ^ ]

希望对您有所帮助! :thumbsup:
Check the link below:

http://blog.divergencehosting.com/2010/01/14/adding-a-check-all-box-to-check-checkboxes-within-a-row-in-a-gridview/[^]

I hope it helps! :thumbsup:


这是一个Google问题...

可以用JavaScript编写

This is such a Google question...

It can be JavaScripted

protected void chkbSelectAll_CheckedChanged(object sender, EventArgs e)
    {
        bool chkFlag = false;
        if (chkbSelectAll.Checked) chkFlag = true;
        foreach (GridViewRow dr in gvProducts.Rows)
        {
            CheckBox chk = (CheckBox)dr.Cells[0].FindControl("Select");
            chk.Checked = chkFlag;
        }
    }




这有帮助吗




Does this help


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

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