查找放置在javascript的gridview提示行内的多行文本框控件 [英] Find multiline textbox control placed inside gridview fotter row in javascript

查看:49
本文介绍了查找放置在javascript的gridview提示行内的多行文本框控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目中的每个人早上好,我在网格视图页脚模板中使用网格视图,其中使用了两个文本框,一个是单行文本框,另一个是多行文本框,我正在使用以下代码来验证JavaScript

Good Morning to every one in my project i am using grid view inside grid view footer template using two text box one is single line text box another one is multy line text box i am using the following code to validate the text box in JavaScript

var gridViewID = "<%=grdMenu.ClientID %>";
           var gridView = document.getElementById(gridViewID);
           var Menuitem = new Ncoretech.Business.Data.MenuType();
           var e = document.getElementById("<%= ddlRestaurantName.ClientID%>");
           var gridViewControls = gridView.getElementsByTagName("input");
           for (i = 0; i < gridViewControls.length; i++) {
                   if (gridViewControls[i].id.search("txtNewMenuName") != "-1") {
                   Menuitem.MenuName = gridViewControls[i].value;
               }
               else if (gridViewControls[i].id.search("txtNewMenuDescription") != "-1") {
                   Menuitem.MenuDescription = gridViewControls[i].value;
               }
           }
           Menuitem.RestaurantIndex_Id = e.options[e.selectedIndex].value;
           if (Menuitem.MenuName == "") {
               alert("Item name has to be enter.");
               return false;
           }
           if (Menuitem.MenuDescription == "") {
               Menuitem.MenuDescription = "none";
           }




在上述方法中,单行文本框没有问题,但在gridViewControls中未显示多行文本框ID.我该如何解决此问题,请给我一个帮助.
在此先感谢

Meganathan M




in the above method the single line textbox having no problem but in the multiline textbox id not shown in the gridViewControls.How can i solve this please any one help to me.
Thanks in advance
By
Meganathan M

推荐答案

多行文本框不是INPUT元素组的一部分,而是TEXTAREA标记.因此,您还需要获取此内容.
例如-
Multiline textbox is not a part of INPUT element group, rather it is a TEXTAREA tag. So you need to fetch this also.
For example-
var gridViewID = "<%=grdMenu.ClientID %>";
           var gridView = document.getElementById(gridViewID);
           var Menuitem = new Ncoretech.Business.Data.MenuType();
           var e = document.getElementById("<%= ddlRestaurantName.ClientID%>");
           var gridViewControls = gridView.getElementsByTagName("input");
           for (i = 0; i < gridViewControls.length; i++) {
               if (gridViewControls[i].id.search("txtNewMenuName") != "-1") {
                   Menuitem.MenuName = gridViewControls[i].value;
               }
           }
           gridViewControls = gridView.getElementsByTagName("textarea");
           for (i = 0; i < gridViewControls.length; i++) {
               if (gridViewControls[i].id.search("txtNewMenuDescription") != "-1") {
                   Menuitem.MenuDescription = gridViewControls[i].value;
               }
           }
           Menuitem.RestaurantIndex_Id = e.options[e.selectedIndex].value;
           if (Menuitem.MenuName == "") {
               alert("Item name has to be enter.");
               return false;
           }
           if (Menuitem.MenuDescription == "") {
               Menuitem.MenuDescription = "none";
           }



希望这可以帮助您...

问候,
尼拉·索尼(Nial Soni)



Hope this may help you out...

Regards,
Niral Soni


这篇关于查找放置在javascript的gridview提示行内的多行文本框控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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