Posts
295
Comments
27
Trackbacks
206
FormView ModeChanged Event

Something I've just discovered upon using the FormView is that the ModeChanged event is not useful for accessing the controls within the template of the new mode. It seems the obvious event, but it's really only a notification that the CurrentMode has changed; the control collection is still under construction, so the controls of the new template aren't available. Any controls you do access (using FindControl of course) will be from the template of the previous mode, not the template of the new mode.

To access the controls in the current template, when the template has changed, you should use the ItemCreated event, checking the CurrentMode to ensure that you find the correct controls.

posted on Wednesday, November 14, 2007 5:23 PM Print
Comments have been closed on this topic.