Missing ViewModel Data

Topics: General, Troubleshooting, Writing modules
Feb 5, 2012 at 7:18 PM

Hi all,

I have a Driver with the two typical Editor methods overridden. I am passing a ViewModel to the view that exposes a couple of extra fields that I want to use as filters on postback.

Basically, the page has FirstNameFilter, LastNameFilter, FilteredUsers drop down and some other fields. Before the form can be saved a single user needs to be selected. To select the user my client wants to type filter values into two text boxes and click a "Update" button that will refresh the view with a list of users matching the filters (no ajax on the drop down).

 The user then selects a user from the resulting filtered drop down, fills in the rest of the form and hits Save.

Problem, in the Editor post method, of my driver, I am calling TryUpdateModel (which fails because the model is not yet valid - expected).
After the call, to TryUpdateModel, I can see the first and last name values that were typed into the textboxs on the form.

When  return Editor(part, shapeHelper); is called, I see the filter values still. But, inside the resuting Editor method call I don't see the values.
The textboxes on the view get the values, so I know they got passed through to the view.

How do I access these values in my initial Editor method?


Feb 5, 2012 at 7:33 PM

Nevermind, solved it by adding the extra fields to the Part and passing them on from the Editor post method.