2015-06-05 32 views
0

我正在開發一個具有Payfast實現的MVC5項目。我有一個視圖,將所有信息提交給Payfast網站進行付款。如果我運行該項目,它總是會給我Compilation Error指向@Scripts.Render("~/bundles/jquery")。我很困惑,請幫忙。MVS 5 with @ Scripts.Render(「〜/ bundles/jquery」)編譯錯誤

這是給我的問題的觀點。

@model Template.Model.PayFastModel 

<body> 
    <form id="hiddenform" [email protected]> 
     @Html.HiddenFor(model => model.merchant_id) 
     @Html.HiddenFor(model => model.merchant_key) 
     @Html.HiddenFor(model=>model.m_payment_id) 
     @Html.HiddenFor(model=>model.payment_mode) 
     @Html.HiddenFor(model => model.name_first) 
     @Html.HiddenFor(model => model.name_last) 
     @Html.HiddenFor(model => model.email_address) 
     @Html.HiddenFor(model=>model.site) 
     @Html.HiddenFor(model => [email protected]) 
     @Html.HiddenFor(model => model.cancel_return) 
     @Html.HiddenFor(model => model.notify_url) 
     @Html.HiddenFor(model => model.item_name) 
     @Html.HiddenFor(model => model.amount) 
    </form> 

    <br/><br /><br /><br /><br /><br /> 
    <p style="text-align: center"> 
     <h3> 
      Connecting to Payfast , please wait ... 

     </h3> 
    </p> 
</body> 
@Scripts.Render("~/bundles/jquery") 

<script type="text/javascript" language="javascript"> 
    $(this.document).ready(function() { 
     var form = $("form"); 
     form.submit(); 
    }); 
</script> 

錯誤消息:enter image description here

+1

什麼是錯誤信息? – Peter

+1

請向我們展示完整的確切錯誤消息。 – DavidG

+0

你的Bundle設置在你的BundleConfig.cs中看起來像什麼? – ragerory

回答

1

請確保您有在Views文件夾中的web.config以下行:

<system.web.webPages.razor> 
    <pages pageBaseType="System.Web.Mvc.WebViewPage"> 
    <namespaces> 
     ... 
     <!-- THIS LINE: --> 
     <add namespace="System.Web.Optimization" /> 

此外,您還可能缺少參考System.Web.Optimization組裝,確保它存在。

+0

在已解決的Views中的web.config中添加''幫助了我。非常感謝您的幫助。 –