Controller action:
public ActionResult Index()
{
ViewData["sample"] = DateTime.Now.ToLongTimeString();
Thread.Sleep(3000);
return View();
}
View page:
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Index</h2>
<div id="divId"><%= Html.Encode(ViewData["sample"])%></div>
<script type="text/javascript">var event = new Object(); $get("panelOneForm").onsubmit();</script>
<%using (Ajax.BeginForm("Index", "Proba", new AjaxOptions() { UpdateTargetId = "divId" }, new { id = "panelOneForm" })) { } %>
</asp:Content>
I try to make auto update View but failed. What is wrong?