2012-11-25 17 views
0

我開始使用Kendo UI,並嘗試在異步模式下使用上傳器,但沒有看到有關此異步對象中可用字段的任何文檔。如何在僅使用HTML的異步對象中指定控制器?

<div style="width: 350px"> 
     <input name="files[]" id="files" type="file" /> 
    </div> 

    <script type="text/javascript"> 
     $(document).ready(function() { 
      $("#files").kendoUpload({ 
       async: { 
        saveUrl: "save", 
        removeUrl: "remove", 
        autoUpload: true 
        //controllerName? Where is the documentation for this? 
       } 
      }); 
     }); 
    </script> 

如果我使用MVC擴展,剃刀語法有一個字段指定控制器名稱。如果我不使用MVC擴展/剃鬚刀語法,我該怎麼做?

回答

1

沒有這樣的選項來指定操作或控制器。您只能指定saveUrl選項的完整URL。作爲變通,你可以使用Url.Action幫手MVC規定:

async: { 
       saveUrl: "save", 
       removeUrl: '@Url.Action("ActionName","Controller")', 
       autoUpload: true 
      }