title: Controller method being called 2 on Search button click
body: <p>Here is my set up. I have Telerik Grid. Here is what the .cshtml.</p>
  
  <pre><code>@(Html.Telerik().Grid&lt;UserViewModel&gt;().Name("UserGrid")
          .DataBinding(binding =&gt; binding.Ajax().Select("List", "Account", Model.ToRoute(Html))
                                                .Insert("Insert", "Account")
                                                .Delete("Delete", "Account")
                                                .Update("Save", "Account"))
          .DataKeys(keys =&gt; keys.Add(model =&gt; model.UserName))
          .ToolBar(toolbar =&gt; toolbar.Template(@&lt;text&gt;
                  @Html.Partial("GridSearchTool")
              &lt;/text&gt;))
          .Columns(columns =&gt;
          {
              columns.Bound(u =&gt; u.Email)
                     .EditorTemplateName("EmailAddress")
                     .Filterable(true)
                     .Sortable(true)
                     .Width(300);
          })
          .Pageable()
          .Filterable()
          .Reorderable(reordering =&gt; reordering.Columns(true))
          .Scrollable(scrollable =&gt; scrollable.Height(500).Enabled(false))
          .Editable(editing =&gt; editing.Enabled(true)
                                      .DisplayDeleteConfirmation(true)
                                      .Mode(GridEditMode.PopUp)
                                      .TemplateName("UserEditor"))
          .ClientEvents(events =&gt; events.OnEdit("onRowEdit")
                                        .OnError("onGridError")
                                        .OnLoad("gridLoaded")
                                        .OnDataBinding("gridAjaxBinding")
                                        .OnDataBound("gridAjaxBound")
                                        .OnSave("gridAjaxSaved"))
  </code></pre>
  
  <p>Here is an entry in my Global.ascx for Routes.</p>
  
  <pre><code> routes.MapRoute(
                  "Users", // Route Name
                  "Account/{action}/{username}", // URL with parameters              
                  new { controller = "Account", action = "Search", username = "" }
              );
  </code></pre>
  
  <p>You will see I have places the Seach as a partial view attached in my grid toolbar. It randers as one Text Box, Buttons (Search and Clear). </p>
  
  <p>Here is the screen shot.</p>
  
  <p><img src="https://i.stack.imgur.com/fBVp6.png" alt="Image of my page"></p>
  
  <p>When I load the grid in my controller here is the functions/actions it calls.
  1) Action Index
  2) Action List</p>
  
  <p>Here are the exaple.</p>
  
  <pre><code>public ActionResult Index(string username)
          {
              return View(new GridViewModel
              {                
                  Query = username,
                  QueryField = "Email",
                  GridName = "UserGrid",
                  Controller = "Account"
              });
          }
  
    [Authorize(Roles = "Administrator")]
          [GridAction]
          public ActionResult List(string username)        
          {
              return Json(GetGridModel(DatabaseContext.FromContext()));
          }
  </code></pre>
  
  <p>This work fine when I initially load the grid. Now I have lots of data on my page and i want to find a particular record so i type my query or string in the text box in the search text box. When i do that here are the controller methods being called.</p>
  
  <p>1) Index (with query entered in the search box)
  2) List (with query entered in the search box)
  3) List (with query entered in the search box)</p>
  
  <p>I dont know why it called the List method mutliple times. 
  I also tried to change the Global.ascx routes with calling different method instead of index but that does not work. It still called the Index multiple times.</p>
  
  <p>I would appreciate any help or ideas regarding this issue. </p>
  
  <p>Also here are the some Javascript methods .</p>
  
  <p>Thanks for the quick reply. Here are both methods i found on one of the java script.</p>
  
  <pre><code>gridAjaxBinding = function (evt) {
          var grid = $(evt.target);
          if (grid.length) {
              grid.block({
                  message: '&lt;div class="loading"&gt;&lt;img src="/Content/images/busy.gif"&gt;&lt;span&gt;Loading...&lt;/span&gt;&lt;/div&gt;'
              });
          }
      };
  gridAjaxBound = function (evt) {
          var grid = $(evt.target);
          if (grid.length) {
              grid.unblock();
          }
  
          grid.unbind('edit', gridAjaxEditing);
          grid.bind('edit', gridAjaxEditing);
  
          var gridId = '#' + grid.attr('id');
  
          // Get the export link as jQuery object
          var $exportLink = $('#export');
          if ($exportLink.length) {
              grid = grid.data('tGrid');
              // Get its 'href' attribute - the URL where it would navigate to
              var href = $exportLink.attr('href');
  
              // Update the 'page' parameter with the grid's current page
              href = href.replace(/page=([^&amp;]*)/, 'page=' + grid.currentPage);
  
              // Update the 'orderBy' parameter with the grids' current sort state
              href = href.replace(/orderBy=([^&amp;]*)/, 'orderBy=' + (grid.orderBy || '~'));
  
              // Update the 'filter' parameter with the grids' current filtering state
              href = href.replace(/filter=(.*)/, 'filter=' + (grid.filterBy || '~'));
  
              // Update the 'href' attribute
              $exportLink.attr('href', href);
          }
  
          setupContextMenu(grid);
      };
  </code></pre>
  
  <p>Thanks,
  Vivek</p>