Milosz,
The workaround I'm using is to turn off ViewState for the FormView
control, and then rebind it on every postback. Since the FormView
never tries to load its state from ViewState the problem of the
controls and control layout being different doesn't arise.
Fortunately, the overhead associated with databinding the FormView in
my application is pretty low.
But it still seems like a kludgy or incomplete solution/approach.
After thinking about it a bit, I got to wondering why the FormView
doesn't support a set of "mapping" properties that indicate which
controls relate to controls in other templates, e.g.,
<FieldMap>
<MapEntry ReadOnlyControl="a" EditControl="b" InsertControl="c" /
>
....
</FieldMap>
Granted, validating the configuration information would be a bit of a
bear, but that's what software developers are for

.
On a related subject, do you happen to know why using "old style"
databinding (i.e., assigning a source to DataSource and calling
DataBind(), as opposed to using DataSourceID) is a second-class
citizen when it comes to retrieving field values in the event
handlers? Given that the bindings are set up by calls to Bind() it
seems to me the FormView "knows" which control relates to which
database fields, regardless of whether new style or old style
databinding is being used. As a user of the "old style" it's a pain in
the butt to have to manually extract the field values in the event
handlers (FYI, I use the old approach because I tend to like to be
able to control when and where databinding takes place; the new style,
from what I can see, has databinding take place whenever the page
"wants" to databind, and I'd have to cancel the databinding in
situations where I don't want it done).
- Mark