質問

I have a HTML form which is in a partial that is loaded via jquery.load(). My partial looks something like this:

@Html.BeginForm(null, null, FormMethod.Post, new { enctype = "multipart/form-data", id = "addComicForm"}){ 
<div class="add-comic-submit">
    <input type="submit" value="haha" name="haha" />
</div>
}

On IE7-8 It's not rendered properly and does not create a form attribute, however, if I manually insert the form code such as

<form action="/ManageComics/ComicAdder" enctype="multipart/form-data" id="addComicForm" method="post" novalidate="novalidate"> </form>

It works properly.

役に立ちましたか?

解決

Because you are doing it wrong. It should be like this:

@using (Html.BeginForm("ComicAdder", "ManageComics", FormMethod.Post, new { enctype = "multipart/form-data", id = "addComicForm" }))
{ 
    <div class="add-comic-submit">
        <input type="submit" value="haha" name="haha" />
    </div>
}

他のヒント

another way should like this:

@{
    Html.BeginForm("your actionName", "your controllerName", FormMethod.Post);
}
<div class="add-comic-submit">
   <input type="submit" value="haha" name="haha" />
</div>
@{
    Html.EndForm();
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top