ASP.NET中具有Listview的JavaScript [英] JavaScript with Listview in asp.net

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

问题描述

我现在有一个带有gridview的脚本,而现在想要的是listview的相应脚本
请帮助我



I have ascript with gridview now iwant the curresponding script for listview
pls help me



var grid = document.getElementById("<%= gvItemUnits.ClientID %>");
        var msgflag = 0;
        var cell;
        if (grid.rows.length > 0) {
            //loop starts from 1. rows[0] points to the header.
            for (i = 1; i < grid.rows.length - 1; i++) {
                //get the reference of first column
                cell = grid.rows[i].cells[1].innerHTML;
                if (obj == cell) {
                    msgflag = 1;
                }
            }
        }
        if (OprMOde == "N") {
            if (msgflag == 1) {
                alert("Duplicate Units not allowed");
                return false;
            }
        }

推荐答案

稍作分析,您便可以自己解决此问题. GridView呈现为Html表. grid变量包含对表的引用,该表在JavaScript中用于进行验证.找出ListView的呈现方式(我相信ListView也呈现为表格),并修改代码使其与ListView一起使用.
With a little bit of analysis, you can solve this problem yourself. The GridView is rendered as an Html table. The grid variable contains the reference to the table which is used in the JavaScript to do the validations. Find out how a ListView is rendered (I believe ListView is also rendered as table) and adapt the code to make it work with a ListView.


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

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