Telerik Extensions for ASP.NET MVC

Version Q1 2012, released 04/19/2012

Client-side Events

Event log

Clear log

About this example ASPXRazor

This example shows the client-side events supported by Telerik Numeric TextBox for ASP.NET MVC.

The numeric textbox has the following events:

  • The OnLoad event is raised when the component is initialized. You can subscribe to that event by using one of the two overloads of the OnLoad method. The one accepts Action as an argument - the other accepts a String. Use the Action overload to define the event handler inline. Use the String overload to specify the name of the JavaScript function which handles the event. The following code shows both options:
    <%= Html.Telerik().NumericTextBox()
            .Name("NumericTextBox")
            .ClientEvents(events => events
                .OnLoad("onLoad")
            )
    
    or
    <% Html.Telerik().NumericTextBox()
           .Name("NumericTextBox")
           .ClientEvents(events => events
           .OnLoad(() => 
           {
            %>
             function(e) {
                 //perform required actions here.
             }
            <%
           })
           .Render();
    
  • The OnChange event is raised when the currently selected value is changed. You can subscribe to that event by using one of the two overloads of the OnChange method:
    <%= Html.Telerik().NumericTextBox()
            .Name("NumericTextBox")
            .ClientEvents(events => events
                .OnChange("onChange")
            )
    
    or
    <% Html.Telerik().NumericTextBox()
           .Name("NumericTextBox")
           .ClientEvents(events => events
           .OnChange(() => 
           {
               %>
                function(e) {
                    //perform required actions here.
                }
               <%
           })
           .Render();
    

Get more than expected!

Take the Telerik Extensions for ASP.NET MVC to your Visual Studio projects to truly experience their power. Download your free copy now and jumpstart your development with the available learning resources.

The Extensions are offered in both open source and commercial versions the differences between which are well explained in the licensing FAQ.

If you have any questions, do not hesitate to contact us at sales@telerik.com.

Other Demos: