Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>Html.Hidden(...)</code> generates a hidden <code>&lt;input&gt;</code>. The <code>&lt;input&gt;</code> values are only sent to the server when you submit a form (by clicking a <code>&lt;input type="submit"/&gt;</code>). </p> <p>In your case, you're creating a hyperlink to another action. When the user clicks it, he will go to the specified URL and he will NOT submit the current form.</p> <p>You should either turn your hyperlink into a submit button and make it submit a form to the action you want, or (easier to do in your sample) to include the field value into the URL:</p> <pre><code>&lt;td&gt;&lt;a href="@Url.Action("ExchangeRateDetails", "ExchangeRate", new { currencyCode = row.CurrencyCodeFromTo, DateFrom = row.LastUpdateDate })"&gt;+&lt;/a&gt; </code></pre> <p><strong>EDIT:</strong> Here's a solution with forms instead of hyperlinks:</p> <pre><code>&lt;tbody&gt; @foreach (var row in Model.Conversions) { &lt;tr&gt; @using (Html.BeginForm("ExchangeRateDetails", "ExchangeRate")) { &lt;td&gt;@Html.DisplayFor(m =&gt; row.LastUpdatedDate) @Html.Hidden("DateFrom", row.LastUpdatedDate) @Html.Hidden("currencyCode", row.CurrencyCodeFromTo) &lt;/td&gt; &lt;td&gt; &lt;input type="submit" value="+" /&gt; &lt;/td&gt; } &lt;/tr&gt; } &lt;/tbody&gt; </code></pre> <p>If you want to keep hyperlinks and not buttons, you can do this too, but you'll have to write some JavaScript to submit a form when a user clicks a link. Alternatively, you can re-style your submit button to look like a hyperlink.</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.
    1. 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