{"id":45,"date":"2011-10-14T14:34:00","date_gmt":"2011-10-14T14:34:00","guid":{"rendered":"https:\/\/wdev-blog.azurewebsites.net\/index.php\/2011\/10\/14\/mvc-tips\/"},"modified":"2011-10-14T14:34:00","modified_gmt":"2011-10-14T14:34:00","slug":"mvc-tips","status":"publish","type":"post","link":"http:\/\/panahy.nl\/index.php\/2011\/10\/14\/mvc-tips\/","title":{"rendered":"MVC Tips"},"content":{"rendered":"<div><span style=\"font-family: Verdana, sans-serif;\"><span lang=\"EN-US\">You can use the standard ASP.NET features in your MVC views. In this case, you call the <\/span><span><span lang=\"EN-US\" style=\"font-size: 9.0pt; line-height: 115%;\">String.Format<\/span><\/span><span lang=\"EN-US\"> method to display the <\/span><span><span lang=\"EN-US\" style=\"font-size: 9.0pt; line-height: 115%;\">UnitPrice<\/span><\/span><span lang=\"EN-US\"> field in a suitable form for a monetary amount. You just pass in the <\/span><span><span lang=\"EN-US\" style=\"font-size: 9.0pt; line-height: 115%;\">Model.UnitPrice<\/span><\/span><span lang=\"EN-US\"> value as the argument to the method call.<\/span><\/span><span lang=\"EN-US\" style=\"font-family: TheSansMonoCondensed-Plain; mso-ansi-language: EN-US; mso-bidi-font-family: TheSansMonoCondensed-Plain;\"><o:p><\/o:p><\/span><\/div>\n<div><span lang=\"EN-US\"><span style=\"font-family: 'Courier New', Courier, monospace;\"><b>&lt;%=<\/b> String.Format(&#8220;{0:F2}&#8221;, Model.UnitPrice) %&gt;<\/span><\/span><\/div>\n<div><span lang=\"EN-US\"><span style=\"font-family: Verdana, sans-serif;\"><br \/><\/span><\/span><\/div>\n<div><span lang=\"EN-US\"><span style=\"font-family: Verdana, sans-serif;\">String class can also be used as a formatter in thextbox:<\/span><o:p><\/o:p><\/span><\/div>\n<div><span lang=\"EN-US\"><span style=\"font-family: Verdana, sans-serif;\"><br \/><\/span><\/span><\/div>\n<div><span lang=\"EN-US\"><span style=\"font-family: 'Courier New', Courier, monospace;\">Unit Price:<br \/><\/span><\/span><span lang=\"EN-US\"><span style=\"font-family: 'Courier New', Courier, monospace;\">&lt;%: Html.TextBoxFor(model =&gt; model.UnitPrice, new {<b>Value<\/b> = <b>String.Format<\/b>(&#8220;{0:F2}&#8221;, Model.UnitPrice)})%&gt;<\/span><span style=\"font-family: TheSansMonoCondensed-Black;\"><o:p><\/o:p><\/span><\/span><\/div>\n<div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>You can use the standard ASP.NET features in your MVC views. In this case, you call the String.Format method to display the UnitPrice field in a suitable form for a monetary amount. You just pass in the Model.UnitPrice value as the argument to the method call. &lt;%= String.Format(&#8220;{0:F2}&#8221;, Model.UnitPrice) %&gt; String class can also be &hellip; <a href=\"http:\/\/panahy.nl\/index.php\/2011\/10\/14\/mvc-tips\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;MVC Tips&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[39],"tags":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"post-thumbnail":false},"uagb_author_info":{"display_name":"Pouya Panahy","author_link":"http:\/\/panahy.nl\/index.php\/author\/pouya\/"},"uagb_comment_info":0,"uagb_excerpt":"You can use the standard ASP.NET features in your MVC views. In this case, you call the String.Format method to display the UnitPrice field in a suitable form for a monetary amount. You just pass in the Model.UnitPrice value as the argument to the method call. &lt;%= String.Format(&#8220;{0:F2}&#8221;, Model.UnitPrice) %&gt; String class can also be&hellip;","_links":{"self":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/posts\/45"}],"collection":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/comments?post=45"}],"version-history":[{"count":0,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/posts\/45\/revisions"}],"wp:attachment":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/media?parent=45"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/categories?post=45"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/tags?post=45"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}