asp.net mvc - Consecutive AJAX Posts C# MVC -
i'm trying post consecutively through ajax, doesn't post sec time around, guess that's because page doesn't reload. post different cells in table , goes different actionresults , located within mvc section render everything.
i'm working in mvc , view posts takes place.
first post:
<tr> @using (ajax.beginform("changecontactinformation", null, new ajaxoptions { updatetargetid = "profiletable" }, formmethod.post)) { <td> @html.textboxfor(x => x.currentuser.contactinformation, new { name = "contactinformation" })<button type="submit">spara</button> </td> } </tr>
second post:
<tr> @using (ajax.beginform("changetemporarymessage", null, new ajaxoptions { updatetargetid = "profiletable" }, formmethod.post)) { <td> @html.textboxfor(x => x.currentuser.contactinformation, new { name = "temporarymessage" })<button type="submit">spara</button> </td> } </tr>
here's controller:
[httppost] public actionresult changetemporarymessage(string temporarymessage) { var model = (profileblockviewmodel)session["model"]; connectionhelper.changetemporarymessage(temporarymessage, model.currentuser.userid); homecoming redirecttoaction("index", model); } [httppost] public actionresult changecontactinformation(string contactinformation) { var model = (profileblockviewmodel)session["model"]; connectionhelper.changecontactinformation(contactinformation, model.currentuser.userid); homecoming redirecttoaction("index", model); }
so first 1 works perfectly, problem after post finished , info updated, cannot post sec 1 or post 1 time again first 1 - no consecutive posts allowed, want. there anyway can accomplish this?
thanks in advance! desex
sigh... got working making next changes:
i changed in view
<tr> @using (ajax.beginform("changetemporarymessage", null, new ajaxoptions { updatetargetid = "profiletable" }, formmethod.post)) { <td> @html.textboxfor(x => x.currentuser.contactinformation, new { name = "temporarymessage" })<button type="submit">spara</button> </td> } </tr>
to this:
<td> @using (ajax.beginform("changetemporarymessage", null, new ajaxoptions { updatetargetid = "profiletable" }, formmethod.post)) { @html.textboxfor(x => x.currentuser.temporarymessage, new { name = "temporarymessage" })<button type="submit">spara</button> } </td>
i solved putting @using directive within < td > tag, around before.
not sure why enabling consecutive posts, if know sense free educate me! :)
regards desex
c# asp.net-mvc asp.net-ajax
No comments:
Post a Comment