c# - Getting input from a ViewUserControl back to the controller on submit -


I will accept that I am new to MVC and this question may be a matter of RTFM but I adopt this problem I am doing and I can not find any solution.

I have been used to fill some details of a specific model for a specific view. I have to present the part of the form using Html.Partial (in fact it is a cover that uses the old non-MVC control from any other project).

I have no problem obtaining data from the controller in the scene.

So what's the problem? How do I retrieve user input from the partial view after the user presses the submit button?


I have currently found this view and the controller:

 @ Model> Poling @using (Html.BeginForm ()) {@ Html.AntiForgeryToken ( ) & Lt; Div class = "form-horizontal" & gt; & Lt; H4 & gt; Poll & lt; / H4 & gt; & Lt; Hour / & gt; @ * @html.validationSamuri (True) * @ @ html.HiddenFor (M => MIID) @html HideFor (M = & gt; M.Nom) @HTML.partial ("~ / control place / quad placeholder.", Model, new viewdata (model)) & lt; Div class = "form-group" & gt; & Lt; Div class = "col-md-offset-2 col-md-10" & gt; & Lt; Input type = "submit" value = "fill" class = "btn btn-default" /> & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; } & Lt; Div & gt; @html.exe link ("back to list", "index") & lt; / Div & gt; @edeptions scripts {@ Scripts.Render ("~ / bundles / jqueryval")}  

This view was duplicated from standard one-to-one with standard built-in editing view available in MVC5 is. Note that this is currently just a POC - Usually the whole thing should be presented in the poll for each question, a question placeholder

Here is the relevant part of Controller:

  // GET: / Poll / Fill [HTPGet] Fill public functions (good id) {var poll = pollRepository. Get (id); See Return (Survey); } // // Post: / Poll / Fill [hippost] Fill Public Actionership (Poll Poll, Form Collection Collection) {Return Direct Reaction ("Index"); } Hold {Return View (Survey); }}  

It is very simple, only this type of app parameter and MVC model builder This should work. It is not important to partially present this form, the process will be passed on submitting the value form of input elements. Another way to use Request.Form ["InputName"] is not my first recommendation.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -