Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>string myTextArea - or you could just check the FormCollection (I would recommend the named variable).</p> <p>If you want to get the model back from the view, you will need to serialize it out as well in order to get back the values. If this is the case, I would convert the whole thing to a view model that either derives from your Model or has a public property that is your model, add a property for MyTextArea and then emit hidden input's for you model, named for the appropriate properties. Assuming that your model is persisted somewhere (database), I would just pass the key (id) and rehydrate the object from within the action result.</p> <pre><code> [HttpPost] public ActionResult ViewMyProducts(ViewMyProductsViewModel viewModel) { if(viewModel.MyTextArea == "something" &amp;&amp; (IEnumerable&lt;foo&gt;)myModel).Count()==5)) { var model = repo.Get(myModel.First().Id); // do something with the model } return View(viewModel); } &lt;%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage&lt;IEnumerable&lt;MyProject.MyDB.MyProducts&gt;&gt;" %&gt; &lt;%@ Import Namespace="MyProject.MyDB" %&gt; &lt;asp:Content ID="Content1" ContentPlaceHolderID="Content" runat="server"&gt; &lt;% using (Html.BeginForm()) {%&gt; &lt;table&gt; &lt;% foreach (var item in Model) {%&gt; &lt;tr&gt; &lt;td&gt; &lt;input type="hidden" name="viewModel.Id" value="&lt;%:item.id%&gt;" /&gt; &lt;%:item.name%&gt; &lt;/td&gt; &lt;td&gt; &lt;%:String.Format("{0:g}", item.date)%&gt; &lt;/td&gt; &lt;/tr&gt; &lt;% } %&gt; &lt;/table&gt; &lt;div&gt; &lt;%:Html.TextArea("MyTextArea")%&gt; &lt;/div&gt; &lt;p&gt; &lt;input type="submit" value="Send" /&gt; &lt;/p&gt; &lt;% } %&gt; &lt;/asp:Content&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload