Search code examples
.netasp.netasp.net-2.0formviewfindcontrol

FormView.FindControl() returns null until DataBind()


Why method FindControl() returns null on FormView until call DataBind().

After that it returns everything correctly?

What workaround are there?

Call DataBind() before first call of FindControl() ?


Solution

  • Either explicitly call DataBind(), or place your code in the DataBound event of the FormView.