mvc – feel my pain – view model is null on postback

I just spent two to three hours because I forgot to put get/set on the public members of my ViewModel.

The “etiology” (symptoms, bad behavior) was that my form posted back but the view model was always null.


public int logkey { get; set;}
public string logtitle { get; set;}
public string bywhom { get; set;}
public string slogdate { get; set;}
public DateTime logdate { get; set;}
public string logentry { get; set;}

I had been copying some working code, but not this part!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: