连续AJAX帖子C#MVC
我试图通过AJAX连续发布,但第二次没有发布,我想这是因为页面没有重新加载。帖子来自表中的不同单元格,指向不同的ActionResults,所有内容都位于MVC部分,我在其中呈现所有内容 我在MVC工作,这是我的观点 第一个职位:连续AJAX帖子C#MVC,c#,asp.net-mvc,asp.net-ajax,C#,Asp.net Mvc,Asp.net Ajax,我试图通过AJAX连续发布,但第二次没有发布,我想这是因为页面没有重新加载。帖子来自表中的不同单元格,指向不同的ActionResults,所有内容都位于MVC部分,我在其中呈现所有内容 我在MVC工作,这是我的观点 第一个职位: <tr> @using (Ajax.BeginForm("ChangeContactInformation", null, new AjaxOptions { UpdateTargetId = "profileTable" }, FormMethod.Po
<tr>
@using (Ajax.BeginForm("ChangeContactInformation", null, new AjaxOptions { UpdateTargetId = "profileTable" }, FormMethod.Post))
{
<td>
@Html.TextBoxFor(x => x.CurrentUser.ContactInformation, new { Name = "ContactInformation" })<button type="submit">Spara</button>
</td>
}
</tr>
因此,第一篇文章工作得很好,但问题是,在该文章完成并更新数据后,我无法从第二篇文章或从第一篇文章再次发表文章-不允许连续发表文章,这正是我想要的。我有没有办法做到这一点 提前谢谢
黛丝叹气。。。通过进行以下更改使其正常工作: 我在视图中改变了这个
<tr>
@using (Ajax.BeginForm("ChangeTemporaryMessage", null, new AjaxOptions { UpdateTargetId = "profileTable" }, FormMethod.Post))
{
<td>
@Html.TextBoxFor(x => x.CurrentUser.ContactInformation, new { Name = "TemporaryMessage" })<button type="submit">Spara</button>
</td>
}
</tr>
@使用(Ajax.BeginForm(“changeTimporaryMessage”,null,新的AjaxOptions{UpdateTargetId=“profileTable”},FormMethod.Post))
{
@Html.TextBoxFor(x=>x.CurrentUser.ContactInformation,新的{Name=“TemporaryMessage”})Spara
}
为此:
<td>
@using (Ajax.BeginForm("ChangeTemporaryMessage", null, new AjaxOptions { UpdateTargetId = "profileTable" }, FormMethod.Post))
{
@Html.TextBoxFor(x => x.CurrentUser.TemporaryMessage, new { Name = "TemporaryMessage" })<button type="submit">Spara</button>
}
</td>
@使用(Ajax.BeginForm(“changeTimporaryMessage”,null,新的AjaxOptions{UpdateTargetId=“profileTable”},FormMethod.Post))
{
@Html.TextBoxFor(x=>x.CurrentUser.TemporaryMessage,新的{Name=“TemporaryMessage”})Spara
}
我通过将@using指令放在deSex尝试查看您的来源。您将看到using语句更改为常规Html表单。如果你知道Html,你就会知道你必须把列放到表的行中,而不是别的。是的,事实上这是很明显的。谢谢你提醒我!:)
<tr>
@using (Ajax.BeginForm("ChangeTemporaryMessage", null, new AjaxOptions { UpdateTargetId = "profileTable" }, FormMethod.Post))
{
<td>
@Html.TextBoxFor(x => x.CurrentUser.ContactInformation, new { Name = "TemporaryMessage" })<button type="submit">Spara</button>
</td>
}
</tr>
<td>
@using (Ajax.BeginForm("ChangeTemporaryMessage", null, new AjaxOptions { UpdateTargetId = "profileTable" }, FormMethod.Post))
{
@Html.TextBoxFor(x => x.CurrentUser.TemporaryMessage, new { Name = "TemporaryMessage" })<button type="submit">Spara</button>
}
</td>