我在这个web应用程序中使用用户控件根据行将其放置在表中依赖于count.用户控件中有4个文本框我已经将每个usercontrol放置在表行中并在页面加载给这个行唯一的ID。问题是,当我提交表单我试图通过行ID获取数据,但控制返回null.i我越来越行,但在该行内,我无法找到控制。如果我做了任何蠕虫,请查看我的代码。在表格行中获取动态生成的控件ID
MasterPage ctl00 = FindControl("ctl00") as MasterPage;
ContentPlaceHolder cplacehld = ctl00.FindControl("ContentPlaceHolder1") as ContentPlaceHolder;
foreach (SeatBookDetails sff in SBD)
{
TableRow trow = (TableRow)cplacehld.FindControl("Row_" + sff.SeatRowId.ToString() + "_" + sff.SeatRowno.ToString());
if (trow != null)
{
string ss = trow.ID;
TextBox txtcust = (TextBox)trow.FindControl("txtcustname");
if (txtcust != null)
{
}
TextBox txtprofession = (TextBox)trow.FindControl("txtprofession");
if (txtprofession != null)
{
}
}
}
当我检查元素我发现结构我附上这个图像看看。 这里可以做些什么?我怎么能得到这个控制?