2012-12-29 32 views
0

在我看來,我有這樣的:MVC(在SItefinity)

@model CreatorModel 

<form name="myForm" action="/Creator/CreateAction" enctype="multipart/form-data" id="myForm" method="post">   

      <div class="a"> 
       <h2 class="a">....</h2> 
       <div class="b"> 
       <br /> 
        Select a file for a <input type="file" name="aFile" id="aFile" /> 
       <br /><br /> 
        Select a file for b<input type="file" name="bFile" id="bFile" /> 
       <br /><br /> 
       <input type="submit" id="CreateAction" name="CreateAction" value="CreateAction" />  
      </div> 

</form> 

但我有一個錯誤:File /Creator/CreateAction is not found (CreateAction is an action from CreatorController)

有什麼可以爲行動<form...>,以便找到行動我進入從控制器?

當我使用這個語法:

@using (Html.BeginForm("FileUpload", "Board", FormMethod.Post, new { enctype = "multipart/form-data" })) { <input type="file" /> <input type="submit" /> } 

我也有一個錯誤:A reference is not set to an instance of an object"

也許有一個錯誤的路由?

回答

2

在Hybrid模式下(在webforms模板上)使用MVC小部件時,需要使用特殊版本的BeginForm(因爲webforms只允許頁面上有一個表單)。

@Html.BeginSitefinityForm() 

應該是你使用你的widget定義表單區域的形式。替換常規的那個,小部件應該按預期工作。

我希望這有幫助!