dimanche 12 février 2017

MVC ID was not map correct

Vote count: 0

i did a search to Database using other field.There is only 1 item in database.

var product= db.products.FirstOrDefault(x => x.nonID == id);
        return product;

the actual ID of the item for example was :112 the nonID was 888

when it was return to view with querystring id=888

  @Html.HiddenFor(model => model.ID)

the hidden field was map to nonID instead of mapping to actual ID in database that was retrived.

this caused me saving problem when ID was not found. anyone know why this was happening?

asked 1 min ago

Let's block ads! (Why?)



MVC ID was not map correct

Aucun commentaire:

Enregistrer un commentaire