在MVC4使用Ajax.BeginForm [英] Using Ajax.BeginForm in MVC4

查看:300
本文介绍了在MVC4使用Ajax.BeginForm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的事情

@using (Ajax.BeginForm("Next", "Controll", null, new AjaxOptions() { UpdateTargetId = "updateRegion", InsertionMode = InsertionMode.Replace, HttpMethod = "GET" }))
{
 <div id="updateRegion">
 @Html.Partial("_callingFromPartial", Model.List[0])
</div>
}


       @Html.RadioButtonFor(item => Model.OptionSelected, Model.IdOption, new { id = "select" + Model.IdOption })
       <label>@Model.OptionText</label>
       <input type="submit" value="Next"/>


[HttpGet]
    public ActionResult Next(Bu.Models.ChoiceQuestion itemReturn)
    {
        CurrentItem = Itens[refe+1];
        return PartialView("_callingFromPartial", CurrentItem);
    }

但它不喜欢的工作我想,我试图加载#updateRegion接下来的内容,但它显示的资源不能被发现。 ,有什么不对的?

But it's not working like I want, I'm trying to load the next content in #updateRegion, but it's showing "The resource cannot be found." , is there anything wrong with this?

推荐答案

尝试将格updateRegion表单标签内。
如: -

Try placing div "updateRegion" inside the form tag. Like :-

@using (Ajax.BeginForm("Next", "Controll", null, new AjaxOptions() { UpdateTargetId = "updateRegion", InsertionMode = InsertionMode.Replace, HttpMethod = "GET" }))
{ 
  <div id="updateRegion">
  </div>
  @Html.RadioButtonFor(item => Model.OptionSelected, Model.IdOption, new { id = "select" + Model.IdOption })
  <label>@Model.OptionText</label>
  <input type="submit" value="Next" />
}

这篇关于在MVC4使用Ajax.BeginForm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆