mxmissile
mxmissile

Reputation: 11682

Input Model Is Not Null

It's Monday. Calling GET on this action with no parameters in the querystring. The input model is coming up not null. Should it not be null? Or is something else going on and I'm not awake yet?

 public ActionResult Report(VariancesReportForm form)
 {
      if (form == null)
           return View();

Upvotes: 0

Views: 109

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1039268

Should it not be null?

No, it shouldn't. The default model binder instantiates the parameter. Then it binds its properties. But since there weren't any query string parameters all the properties will be null.

Upvotes: 2

Related Questions