[英]Creating a single page application using asp.net MVC4 and AngularJs
[英]Using and Creating helper in Asp.net MVC4 Web Application
我使用的是Asp.net mvc4 WebRole,我發現這是一個Web應用程序,而不是一個Web站點。 閱讀本文后 ,我知道如何在Asp.MVC4中添加客戶幫助程序功能。 在網站應用中,我可以在app_code文件夾中添加一個cshtml文件,如下所示,以便我可以在另一個cshtml中使用我的自定義幫助方法。
@helper HotDeployButton(string value, string url , bool enable= true){
string enablestr = string.Empty;
if (!enable)
{
enablestr = "disabled=\"disabled\"";
}
<input type="button" name="@value" value="@value" onclick=" window.location.href='@url'" class="mobile-button" @enablestr />
}
@helper Img(string picName, string alt ){
string root = "/content/themes/default/images/";
string imgurl = root + picName;
<img alt="@alt" src="@imgurl" title="@alt" />
}
在下面顯示的另一個cshtml中將使用HotDeployButton
方法。
<div class="bottom-div">
@Html.Hidden("hdSelMinorPackId", "")
<!--Html.Hidden("randomId", (object)ViewBag.RandomId)-->
<input type="submit" name="ExcuteDeploy" id="ExcuteDeploy" value="Deploy" onclick="return validateVersion();"
class="mobile-button" />
@Helpers.HotDeployButton("Back", Url.Action("Index"))
</div>
但在Asp.net Web應用程序中,項目中沒有App_code文件夾。 我不知道如何在Web應用程序中創建它。 請幫幫我。謝謝
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.