This control needs reference to both MVCControlToolkit.Controls-x.x.x.js or the smaller MVCControlToolkit.Controls.Core-x.x.x.js and jquery-1.4.2.js. (or better)
Timer Helpers perform either an Ajax Get to a completely configurable route or a Submit(that may cause either a Get or a Post, either synchronous or ajax, according on how the form is defined) at regular time intervals. They are useful to "poll"
the server for updates, and they make easier to design Web Gadgets, or Web Chats. If the polling time is less than the session expiration time, sessions can be kept alive without the need for the user to perform any action.
The Submit type Timer helper is defined as:
public static MvcHtmlString SubmitTimer<VM>(
this HtmlHelper<VM> htmlHelper, TimeSpan timeInterval, string clientViewModel=null)
If the optional clientViewModel string is not null, a
client-side view model with that name is saved before submitting the form.
The GetType Timer is defined as:
public static MvcHtmlString GetTimer<VM>(
this HtmlHelper<VM> htmlHelper, TimeSpan timeInterval,
string controllerName = null,
object parameters = null,
string routeName = null,
string protocol = null,
string hostname = null,
string fragment = null,
InsertionMode mode = InsertionMode.Replace,
The timeInterval parameter defines the time interval the Get operation is performed, the targetIdName is the id of the target Html element that will receive the Ajax content, the
mode parameter specifies how the new content is inseted in the target node, and the
Below, a Get Timer is used to get the server Time:
<%: Html.GetTimer(new TimeSpan(0, 0, 1), "ServerTime", "clock") %><div id="clock"></div>