asp.net mvc 3 - passing data between page to controller -


i have poll in web site , each poll have dynamic answer answer save database want edit answer

answer = new answer(); var ans = an.readbybyqid(int64.parse(viewdata["id"].tostring())); <div class="editor-label">         answer     </div>     <div class="editor-field">         @foreach (var item in ans)         {             <input type="text" name="answer" value="@item.answere" />          }     </div> 

i want id of answer in controller edit answer in database

save id in hidden input , form post data have answerid , can access in action same way access answer.

 answer = new answer();   var ans = an.readbybyqid(int64.parse(viewdata["id"].tostring()));   <div class="editor-label">         answer     </div>     <div class="editor-field">         @foreach (var item in ans)         {             <input type="text" name="answer" value="@item.answere" />              <input type="hidden" id="answerid" value="@ans" />          }     </div> 

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Socket.connect doesn't throw exception in Android -

SPSS keyboard combination alters encoding -