Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The code in your edited example fails because of the double use of doublequotes.</p> <p>Regarding only showing the confirmation with the company name if <code>item.primary_company.HasValue</code> is true, it can be done either server side or client side.</p> <p>Server side, change how the link works depending on the status:</p> <pre><code>&lt;% if (item.primary_company.HasValue) { %&gt; &lt;a href="#" onclick="return Actionclick('&lt;%= Url.Action("Activate", new {id = item.company_id}) %&gt;', '&lt;%= Html.Encode(item.company1.company_name) %&gt;');" class="fg=button fg-button-icon-solo ui-state-default ui-corner-all"&gt;&lt;span class="ui-icon ui-icon-refresh"&gt;&lt;/span&gt;&lt;/a&gt; &lt;% } else { %&gt; &lt;a href="&lt;%= Url.Action("Activate", new {id = item.company_id}) %&gt;" class="fg=button fg-button-icon-solo ui-state-default ui-corner-all"&gt;&lt;span class="ui-icon ui-icon-refresh"&gt; link&lt;/span&gt;&lt;/a&gt; &lt;% } %&gt; &lt;script type="text/javascript"&gt; function Actionclick(url,companyName) { if (confirm('Confirm. CompanyName = ' + companyName)) { location.href = url; } }; &lt;/script&gt; </code></pre> <p>Client side, send a parameter to javascript, telling it whether or not to confirm:</p> <pre><code>&lt;a href="#" onclick="return Actionclick('&lt;%= Url.Action("Activate", new {id = item.company_id}) %&gt;', '&lt;%= Html.Encode(item.company1.company_name) %&gt;', &lt;%= item.primary_company.HasValue ? "true" : "false" %&gt;));" class="fg=button fg-button-icon-solo ui-state-default ui-corner-all"&gt;&lt;span class="ui-icon ui-icon-refresh"&gt;&lt;/span&gt;&lt;/a&gt; &lt;script type="text/javascript"&gt; function Actionclick(url,companyName,showConfirmation) { if (showConfirmation) { if (confirm('Confirm. CompanyName = ' + companyName)) { location.href = url; } } else { location.href = url; } }; &lt;/script&gt; </code></pre>
 

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