Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何从表单视图中包含的控件执行句柄,仅在代码中我可以看到表单视图,但看不到插入模板中的控件。
感谢您的帮助
您必须使用 FindControl 方法来查找控件。
TextBox txtEmail = (TextBox)FormView1.FindControl("ControldID");
这是因为不能直接访问 DataBound 控件中的控件。要访问这些控件,您必须使用该FindControl方法并将其转换为适当的控件。
FindControl