Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Null Model fields in Edit Post method

$
0
0

I'm attempting to get an ASP.NET Core 2 application to function in a very specific way. Here is the breakdown...

  • Basic Core 2 application using entity framework.
  • Default Home Controller and Views.
  • Clients Entity and Controller - (clientid, clientuserid, firstname, lastname...)

This is NOT a secure application model, nor am I attempting to create one... this is purely a question of functionality! 

The default Home/Index method has a "form and field" for the end user to enter their "clientuserid" (8 to 10 digits i.e. 98632514 - something they have). When a valid length field is entered (simple client side validation), the application pops up a modal asking for the end users password (this is actually the users last name by default). Not secure, but prevents chance posting of clientid's. The two field form is then sent HTTPPost method "find", so as not to show id and password in browser url. If the information is valid and accurate, the action then sends them the appropriate "Client" Edit form (in this case the default edit form created by the visual studio template).  When the user Edits the data and posts the data everything works as expected! This is the action I was looking for.

Now with the search and authorize methods working, I go about customizing the EDIT form. There is no magic to this... I take the original "default" edit form, make a copy, and create a new form based on the original using most of the helper functions from the original. Mostly, the changes, using Bootstrap, are nested because of specific formatting. The overall form and fields never really change (form structure is proper and fields are the 90% reused the only fields that are changed are drop down selections that are simple stored as strings)... After this everything continues to work with the except of the form  post back (form submit) to the HTTPPost Edit function. The client model is coming back "nearly" all null... By nearly I mean that "some" of the fields are there, but most are not. The simple boolean fields remain and are accurate along with a single url string field, everything else in the model is null including the  "firstname, middle, lastname, email, etc.. these are all null. I am reusing ALL the Helper methods from the original form, with Bootstrap formatting being the only real changes.

Is there some sort of bug in ASP.NET Core 2 where the form is not properly parsed? I do not get any errors at all, and if I go back to the original saved forms everything works again... Can someone provide some insight here? Any help would be appreciated.

Thanks in advance,

Stew Basterash


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>