【问题标题】:MVC (in SItefinity)MVC(在 Sitefinity 中)
【发布时间】:2012-12-29 16:07:30
【问题描述】:

在我看来,我有类似的东西:

@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)

我可以在&lt;form...&gt; 中输入什么作为操作以从控制器中查找操作?

当我使用这种语法时:

@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"

可能有错误的路由?

【问题讨论】:

    标签: model-view-controller sitefinity


    【解决方案1】:

    在混合模式下使用 MVC 小部件时(在 webforms 模板上),您需要使用特殊版本的 BeginForm(因为 webforms 只允许页面上的一个表单)。

    @Html.BeginSitefinityForm()
    

    应该是您用来在小部件中定义表单区域的表单。用它替换常规的,小部件应该可以按预期工作。

    希望对你有帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-17
      • 1970-01-01
      • 2014-12-10
      • 2017-10-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多