Note that there are some explanatory texts on larger screens.

plurals
  1. POInput validation in MVC 3
    primarykey
    data
    text
    <p>I am developing the CRM and facing some troubles in model validation.The process looks simple when only one object in the model(i am using EF) is validated on the form. But when i am trying to process validation on multiply objects, only one top record got validated. Here is the code:</p> <pre><code>@model List&lt;CROS1.Models.GetParams_Result&gt; // &lt;h3 align="center"&gt; Please fill report params &lt;/h3&gt; &lt;div class="sidebar_item"&gt; @using (@Ajax.BeginForm("ConfirmGeneration", "Home", ajaxOptions: new AjaxOptions { HttpMethod = "GET", UpdateTargetId = "params", InsertionMode = InsertionMode.Replace, LoadingElementId = "resultLoadingDiv", }, htmlAttributes: new { id = "Form2" })) { &lt;table id="hor-minimalist-b"&gt; &lt;tread&gt; &lt;tr&gt; &lt;th scope ="col"&gt;Report&lt;/th&gt; &lt;th scope ="col"&gt;Filter&lt;/th&gt; &lt;th scope ="col"&gt;Value&lt;/th&gt; &lt;/tr&gt; &lt;/tread&gt; @foreach (CROS1.Models.GetParams_Result res in Model) { &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;@Html.DisplayTextFor(r =&gt; res.R_name) &lt;/td&gt; &lt;td&gt;@Html.DisplayTextFor(r =&gt; res.Filter_name) &lt;/td&gt; &lt;td&gt;@Html.EditorFor(r =&gt; res.Value) @Html.ValidationMessageFor(r=&gt;res.Value) &lt;/td&gt; &lt;td&gt;@Html.DisplayFor(r =&gt; res.Unity) &lt;/td&gt; @Html.HiddenFor(r=&gt;res.F_id) @Html.HiddenFor(r=&gt;res.R_id) @Html.HiddenFor(r=&gt;res.Filter_id,new{id="some"}) @Html.HiddenFor(r =&gt; res.F_name) @Html.HiddenFor(r =&gt; res.Filter_name)*@ @Html.HiddenFor(r=&gt;res.DefaultValue) @Html.HiddenFor(r=&gt;res.Visibles) &lt;/tr&gt; &lt;/tbody&gt; } &lt;/table&gt; @* &lt;input type="submit" id="submGetParams" /&gt;*@ } &lt;/div&gt; </code></pre> <p>What i should do in this case? How the model must look like to be able to perform such validation?</p>
    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.
 

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