我使用UltraWebGrid控件,在第一列设置为CheckBox属性,想选种某些行的CheckBox,然后按删除按钮删除该行,或者选择某一CheckBox控件全选UltraWebGrid控件选中的CheckBox或取消,在课户端如何实现?谢谢。

解决方案 »

  1.   

    http://singlepine.cnblogs.com/archive/2005/11/01/266538.htmlfunction chkAll_true()
                {
                    var chkall= document.all["chkAll"];
                    var chkother= document.getElementsByTagName("input");
                    for (var i=0;i<chkother.length;i++)
                    {
                        if( chkother[i].type=='checkbox')
                        {
                            if(chkother[i].id.indexOf('chkExport')>-1)
                            {
                                if(chkall.checked==true)
                                {
                                    chkother[i].checked=true;
                                }
                                else
                                {
                                    chkother[i].checked=false;
                                }
                            }
                        }
                    }
                }
                
                function Delete()
                {
                    var  al = new Array();
                    var chkother= document.getElementsByTagName("input");
                    for(var i=0,j=0;i<chkother.length;i++)
                    {
                        if( chkother[i].type =='checkbox')
                        {
                            if(chkother[i].id.indexOf('chkExport')>-1)
                            {
                                if(chkother[i].checked==true)
                                {
                                    al[j] =chkother[i].value;
                                    j++;
                                }
                            }
                        }
                    }
                    if (al == "")
                    {
                        alert('You need to select a row in the list before selecting Delete.\r\nPlease select a row and try again.');
                    }
                    else if (window.confirm("Are you sure to delete all these?"))
                    {
                        var deleteID='<%=btndelete.ClientID%>';
                        window.document.all(deleteID).click();
                    }
                    else { return false; }               
                }