0

From a demo solution i tried to use the built in mvc ajax features. But for some reason the partial view is not beeing replaced.

@using (Ajax.BeginForm("RefreshPartial", "Home",  new AjaxOptions() { UpdateTargetId = "PartialToRefresh", HttpMethod = "Post" }))
{ 
    @Html.TextBox("Name");
    <input type="submit" value="Send name" />
}
<br />
<div>
    @Ajax.ActionLink("Just refresh", "RefreshPartial", "Home", null, new AjaxOptions() { UpdateTargetId = "PartialToRefresh", HttpMethod = "Post" }, null)
</div>
<br />
<div id="PartialToRefresh">
    @Html.Partial("_DateTimePartial", "test")
</div>
rene
  • 41,474
  • 78
  • 114
  • 152
Stian Standahl
  • 2,506
  • 4
  • 33
  • 43

1 Answers1

0

When i displayed the HTML page i got this html code

<form action="/Home/RefreshPartial" id="form0" method="post" onclick="Sys.Mvc.AsyncForm.handleClick(this, new Sys.UI.DomEvent(event));" onsubmit="Sys.Mvc.AsyncForm.handleSubmit(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, httpMethod: 'Post', updateTargetId: 'PartialToRefresh' });">                       
    <input id="Name" name="Name" type="text" value="">    
    <input type="submit" value="Send name">
</form>

After some googling i found out that the web.config has the unobtrusive flag set to false.

  <appSettings>
    <add key="ClientValidationEnabled" value="true"/> 
    <add key="UnobtrusiveJavaScriptEnabled" value="false"/> 
  </appSettings>

This must OFFCOURSE be TRUE! :)

Stian Standahl
  • 2,506
  • 4
  • 33
  • 43