本文介绍了JavaScript中的GridView页脚行文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在使用javascript很容易地访问Gridview的行。
但是,当我尝试添加一个新行然后尝试访问时,代码无法正常工作。
我可以访问页脚行文本框吗?
I have been accessing the rows of Gridview quite easily using javascript.But when I try to add a new row and then try to access, then the code is not working.Is there a way by which I can access the footer row text box?
下面是我的代码,当编辑模式文本框被访问。
Below is my code which works well when edit mode text boxes are to be accessed. Please donot post any link.
function OnSelectIndexChange() {
var drpdwn = document.getElementById("ddlSelectUnderwriterCond");
var drpdwnValue = drpdwn.options[drpdwn.selectedIndex].text;
var gridview = document.getElementById("<%= StandardUndewritingGrid.ClientID %>");
for (var i = 1; i <= gridview.rows.length; i++) {
var labels = gridview.rows[i].cells[0].getElementsByTagName("input")[0].value;
var txtbx = gridview.rows[i].cells[0].children[0];
if (drpdwnValue != '-- Select --')
txtbx.value = labels + '<^>' + drpdwnValue + '<^>';
}
}
推荐答案
I刚刚想出了一种访问页脚行的方法,代码工作正常,所以我张贴了,因为它可能会帮助某人:
I have just figured out a way of accessing the footer row and code is working fine so I am posting as it might help someone as well:
var flabels = document.getElementById('<%=((TextBox)gridname.FooterRow.FindControl("controlname")).ClientID %>');
if (flabels != null) {
}
这篇关于JavaScript中的GridView页脚行文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!