复选框值存储 [英] checkbox value storing

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

问题描述

如何编写代码以检查转发器控件中的复选框???????
帮我lpz如何编写代码???????/

how to write code to check the checkbox in repeater control??????
help me lpz how to write code???????/

推荐答案

希望下面的代码能帮助您解决问题

Hi Hope the below code will help you solve your problem

function SelectAll(id) {
            //get reference of GridView control
            var grid = document.getElementById("<%= this.myGridView.ClientID %>");
            //variable to contain the cell of the grid
            var cell;

            if (grid.rows.length > 0) {
                //loop starts from 1. rows[0] points to the header.
                for (i = 1; i < grid.rows.length; i++) {
                    //get the reference of first column
                    cell = grid.rows[i].cells[0];

                    //loop according to the number of childNodes in the cell
                    for (j = 0; j < cell.childNodes.length; j++) {
                        //if childNode type is CheckBox
                        if (cell.childNodes[j].type == "checkbox") {
                            //assign the status of the Select All checkbox to the cell checkbox within the grid
                            cell.childNodes[j].checked = document.getElementById(id).checked;
                            }
                        }
                    }
                }
            }
        }


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

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