Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>on the line where is says:</p> <pre><code>totalMessage = "Total = " + total; </code></pre> <p>Try this instead:</p> <pre><code>totalMessage = "Total = " + total.ToString("0.00"); </code></pre> <p>Let me know if that helps.</p> <p>Goodluck</p> <p>=======================================</p> <p>Here is the code I have working on my machine:</p> <pre><code>@{ </code></pre> <p><strong>var total = 0m;</strong></p> <pre><code> var totalMessage = ""; if (IsPost) { var age = Request["frmage"].AsInt(); var weight = Request["frmweight"].AsDecimal(); var SerCre = Request["frmSerCre"].AsDecimal(); var sexfactor = Request["frmGender"].AsBool(); total = Convert.ToDecimal(age*SerCre); totalMessage = "Total = " + total.ToString("0.00"); } } &lt;form method="post"&gt; &lt;p&gt; &lt;label for="text1"&gt;Age:&lt;/label&gt; &lt;input type="text" name="frmAge" size="3" /&gt;Years &lt;/p&gt; &lt;p&gt; &lt;label for="text2"&gt;Weight:&lt;/label&gt; &lt;input type="text" name="frmWeight" /&gt;in Kg (1st = 6.35kg) &lt;/p&gt; &lt;p&gt; &lt;label for="text3"&gt;Serum Creatinine:&lt;/label&gt; &lt;input type="text" name="frmSerCre" /&gt; μmol/L &lt;/p&gt; &lt;p&gt; &lt;label for="text4"&gt;Gender:&lt;/label&gt; &lt;select name="frmGender" id="select"&gt; &lt;option value="M"&gt;Male&lt;/option&gt; &lt;option value="F"&gt;Female&lt;/option&gt; &lt;/select&gt; &lt;/p&gt; &lt;p&gt; &lt;input type="submit" value="Calculate" /&gt;&lt;/p&gt; &lt;/form&gt; &lt;p&gt;@totalMessage&lt;/p&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. 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