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

The grid 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().Grid(Model)
              .Name("Grid")
              .ClientEvents(events => events
                  .OnLoad("onLoad")
              )

  or

      <% Html.Telerik().Grid(Model)
             .Name("Grid")
             .ClientEvents(events => events
             .OnLoad(() =>
             {
              %>
               function(e) {
                   //perform required actions here.
               }
              <%
             })
             .Render();

- The OnDataBinding event is raised when the grid is requesting data. You can subscribe to that event by using one of the two overloads of the `OnDataBinding` method:

      <%= Html.Telerik().Grid(Model)
              .Name("Grid")
              .ClientEvents(events => events
                  .OnDataBinding("onDataBinding")
              )

  or

      <% Html.Telerik().Grid(Model)
             .Name("Grid")
             .ClientEvents(events => events
             .OnDataBinding(() =>
             {
                 %>
                  function(e) {
                      //perform required actions here.
                  }
                 <%
             })
             .Render();

- The OnDataBound event is raised when the grid is databound. You can subscribe to that event by using one of the two overloads of the `OnDataBound` method:

      <%= Html.Telerik().Grid(Model)
              .Name("Grid")
              .ClientEvents(events => events
                  .OnDataBound("onDataBound")
              )

  or

      <% Html.Telerik().Grid(Model)
             .Name("Grid")
             .ClientEvents(events => events
             .OnDataBound(() =>
             {
                 %>
                  function(e) {
                      //perform required actions here.
                  }
                 <%
             })
             .Render();

- The OnError event is raised when an error occurs during data retrieval. You can subscribe to that event by using one of the two overloads of the `OnClose` method:

      <%= Html.Telerik().Grid(Model)
              .Name("Grid")
              .ClientEvents(events => events
                  .OnError("onError")
              )

  or

      <% Html.Telerik().Grid(Model)
             .Name("Grid")
             .ClientEvents(events => events
             .OnError(() =>
             {
                 %>
                  function(e) {
                      //perform required actions here.
                  }
                 <%
             })
             .Render();

- The OnRowDataBound event is raised when row in the grid is databound. You can subscribe to that event by using one of the two overloads of the `OnRowDataBound` method:

      <%= Html.Telerik().Grid(Model)
              .Name("Grid")
              .ClientEvents(events => events
                  .OnRowDataBound("onRowDataBound")
              )

  or

      <% Html.Telerik().Grid(Model)
             .Name("Grid")
             .ClientEvents(events => events
             .OnRowDataBound(() =>
             {
                 %>
                  function(e) {
                      //perform required actions here.
                  }
                 <%
             })
             .Render();

- The OnRowSelected event is raised when a row in the grid is selected. You can subscribe to that event by using one of the two overloads of the OnRowSelected method:

      <%= Html.Telerik().Grid(Model)
              .Name("Grid")
              .Selectable()
              .ClientEvents(events => events
                  .OnRowSelected("onRowSelected")
              )

  or

      <% Html.Telerik().Grid(Model)
             .Name("Grid")
             .Selectable()
             .ClientEvents(events => events
             .OnRowSelected(() =>
             {
                 %>
                  function(e) {
                      //perform required actions here.
                  }
                 <%
             })
             .Render();