gridview选择中的性能问题 [英] Performance issue in gridview selction

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

问题描述

我的网站上有一个GridView,它可以很好地绑定超过1000条记录。但是当我选择GridView行时,我面临性能问题。



对于这些,我尝试了不同的方法来提高性能。但我仍然面临着这个问题。



任何人都有任何建议或帮助吗?



我尝试过:



< script type =    text / javascript> 
/ * 第一种方法* /
$( function (){
$( [id * = GVTaskList] )。find( [id * = lnkSelect])。click( function (){
// 引用GridView行。
var row = $( this )。nearest( tr);
var 条消息= 行索引: +(行[ 0 ].rowIndex - 1 );
$(' #hdnGVTaskList')。val(行[ 0 ]。rowIndex - 1 );
document .getElementById( BtnGVTaskList< /跨度>)点击();
return false ;
});
});

/ * 第二种方法* /
function RadioCheck(rb){

var gv = document .getElementById( <%= GVTaskList.ClientID%>) ;

var rbs = gv.getElementsByTagName( 输入);

var row = rb.parentNode.parentNode;

for var i = 0 ; i< rbs.length; i ++){

if (rbs [i] .type == < span class =code-string>
radio){
if (rbs [i] .checked&& rbs [i]!= rb){
rbs [i] .checked = false ;
break ;
}
}
}
// document.getElementById( BtnGVTaskList)。click();
}

/ * 第三种方法是GVTaskList_SelectedIndexChanged * /
< / script>

解决方案

function (){


[id * = GVTaskList])。find( [id * = lnkSelect])。click( function (){
// 引用GridView行。
var row =


this )。nearest( tr< /跨度>);
var message = 行索引: +(row [ 0 ]。rowIndex - 1 );


I have a GridView in my website and it's working fine with binding more than 1000 records. But I am facing performance issue when I selecting the GridView row.

For these I have tried different ways to increase the performance. But still I am facing the issue.

Any one have any suggestions or help?

What I have tried:

<script type="text/javascript">
            /* 1st Method */
            $(function () {
                $("[id*=GVTaskList]").find("[id*=lnkSelect]").click(function () {
                    //Reference the GridView Row.
                    var row = $(this).closest("tr");
                    var message = "Row Index: " + (row[0].rowIndex - 1);
                    $('#hdnGVTaskList').val(row[0].rowIndex - 1);
                    document.getElementById("BtnGVTaskList").click();
                    return false;
                });
            });

            /* 2nd Method */
            function RadioCheck(rb) {

                var gv = document.getElementById("<%=GVTaskList.ClientID%>");

                var rbs = gv.getElementsByTagName("input");

                var row = rb.parentNode.parentNode;

                for (var i = 0; i < rbs.length; i++) {

                    if (rbs[i].type == "radio") {
                        if (rbs[i].checked && rbs[i] != rb) {
                            rbs[i].checked = false;
                            break;
                        } 
                    }
                }
                //document.getElementById("BtnGVTaskList").click();
            }

            /* 3rd Method is GVTaskList_SelectedIndexChanged */
        </script>

解决方案

(function () {


("[id*=GVTaskList]").find("[id*=lnkSelect]").click(function () { //Reference the GridView Row. var row =


(this).closest("tr"); var message = "Row Index: " + (row[0].rowIndex - 1);


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

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