.net - FormView.FindControl() 在 DataBind() 之前返回 null

标签 .net asp.net asp.net-2.0 formview findcontrol

为什么方法 FindControl() 在调用 DataBind() 之前在 FormView 上返回 null

之后它会正确返回所有内容吗?

有什么解决方法?

在第一次调用 FindControl() 之前调用 DataBind() ?

最佳答案

要么显式调用 DataBind(),要么将代码放在 FormView 的 DataBound 事件中。

关于.net - FormView.FindControl() 在 DataBind() 之前返回 null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2171427/

相关文章:

asp.net - Web 应用程序中的 HttpContext.Current 是否为 Null?

css - 在 asp.net 2.0 中动态应用 CSS

c# - Task.Run 和 System.Threading.ThreadPool.RunAsync 之间有什么区别?

c# - DropDownListFor Inside EditorFor 不选择值

c# - 调整窗口大小导致黑条

c# - 安装 Visual Studio 2017 Enterprise 后出现 ERR_CONNECTION_RESET

asp.net - 如何部署/发布 ASP.NET 网站?

c# - 处理时页面模糊并显示gif图像

c# - Resharper 和自定义实时模板不工作

c# - 简单的 SQL 命令不适用于特定参数