views:

375

answers:

2

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() ?

+1  A: 

How would a FormView have any information about its content before it has any data to build it upon?

So I guess you already answered your own question, you will have to DataBind() before.

herzmeister der welten
+2  A: 

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

devio