asp.net中的gridview项目模板 [英] gridview item template in asp.net

查看:78
本文介绍了asp.net中的gridview项目模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在项目模板中具有100行的gridview.
示例用户想要填充一行(项目,数量,数量)等,如果项目列为空,则显示警告行,其中没有项目不能为空.

i have gridview with 100 rows in item template.
Example user want to fill one row (item,quantity,amount) etc. and if item column is empty then show alert box with row no item can''t be empty.

推荐答案

您需要将字段转换为模板字段并应用验证器,从而将验证控件添加到编辑界面 [ ^ ].

试试吧!
You need to convert the fields into template fields and apply validator thus Adding Validation Controls to the Editing Interface[^].

Try!


嗨............

我在javascript中有以下解决方案.您可以在按钮提交或任何其他事件时调用此代码.


hi............

I have following solution for which in javascript.you can call this code on button submit or any other event.


<pre lang="Javascript">

var inputListUnit = document.getElementById('gridName').getElementsByTagName("input");
    for (var i = 0; i < document.getElementById('grvUnit').rows.length; i++) {
        if (inputListUnit[i].type == "text") {
            if (document.getElementById(inputListUnit[i].id).value =='') {
                alert('item can't be empty')
            }
        }
    }




希望对您有帮助.




I hope it helps you.


这篇关于asp.net中的gridview项目模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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