本文介绍了如何在动态ID中查找文本框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
TextBox tb = new TextBox();
//tb.ID = "TextBoxCol_" + i + "Col_" + j;
tb.ID = "TextBoxCol_" + i;
cell.Controls.Add(tb);
row.Cells.Add(cell);
TextBox txtBox = (TextBox)Page.FindControl("ctl00_TextBoxCol_0");
"ctl00_TextBoxCol_0
"是通过此ID动态生成的ID,找不到该文本框值.
"ctl00_TextBoxCol_0
" this is dynamic generated id through this id not find the textbox value
推荐答案
TextBox txtBox = (TextBox)Page.FindControl("TextBoxCol_0");
var txtdate1 = document.getElementById('<%=txtdate1.ClientID%>');
希望这对您有帮助,
谢谢
-Amit.
Hope this will help you,
Thanks
-Amit.
这篇关于如何在动态ID中查找文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!