c# - ASP.NET MVC looking for wrong action(without parametrs) -


i want create edits views, 1 big model in table, there smaller models" basic informations, contact informations etc, model table big , don't want create 1 edit view 20 textboxes.

so here problem create httpget action parametr id, , httppost model. , when i'm sending form got error system.missingmethodexception, dont have action method without parametrs..

kontrahenci model ef table. daneoglnekontrahenta assistant class, send 6 variables instead of 20.

[httpget] public actionresult edytujdaneogolne(int? id) {      if (id == null)     {         redirect("index");     }      kontrahenci kontrahent = db.kontrahenci.find(id);      if (kontrahent == null)     {         redirect("index");     }      daneoglnekontrahenta model = new daneoglnekontrahenta(kontrahent);      return view(model); } 

post method:

[httppost] public actionresult edytujdaneogolne(int id, daneoglnekontrahenta kontrahent) {      kontrahenci kontrahentmodel = db.kontrahenci.find(id);      if (kontrahentmodel == null)     {         redirect("index");     }      kontrahentmodel.nazwa = kontrahent.nazwa;     kontrahentmodel.nazwaskrocona = kontrahent.nazwaskrocona;     kontrahentmodel.nip = kontrahent.nip;     kontrahentmodel.komentarz = kontrahent.komentarz;     kontrahentmodel.uwagids = kontrahent.uwagids;     kontrahentmodel.uwagizlecenie = kontrahent.uwagizlecenie;      db.savechanges();      return view("detalis"); } 

then in view:

@using(html.beginform()) {  //some textboxes   <input type="submit" value="create" class="btn btn-default" /> } 

you need specify controller name , action in begin form method

@using(html.beginform("actionname","controllername",formmethod.get)) // or post {  //some textboxes   <input type="submit" value="create" class="btn btn-default" /> } 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -