title: ASP.NET MVC 2.0 Implementation of searching in jqgrid
body: <p>Hi I am trying to use the single column search in jqgrid using MVC 2 IN .NET (VS 2008)  this is the code I have so far but I need an example to match it with or a tip of what I am missing </p>
  
  <pre><code>jQuery("#list").jqGrid({
      url: '/Home/DynamicGridData/',
      datatype: 'json',
      mtype: 'POST',
      search: true,
      filters: {
          "groupOp":"AND",
          "rules": [
              {"field":"Message","op":"eq","data":"True"}
          ]
      },
      multipleSearch: false,
      colNames: [ 'column1', 'column2'],
      colModel: [
          { name: 'column1', index: 'column1', sortable: true, search: true,
            sorttype: 'text', autoFit: true,stype:'text',
            searchoptions: { sopt: ['eq', 'ne', 'cn']} },
          { name: 'column2', index: 'column2', sortable: true,search: false,
            sorttype: 'text', align: 'left', autoFit: true}],
      pager: jQuery('#pager'),
      rowNum: 10,
      rowList: [10, 60, 100],
      scroll: true,
      sortname: 'column2',
      sortorder: 'asc',
      gridview: true,
      autowidth: true,
      rownumbers: true,
      viewrecords: true,
      imgpath: '/scripts/themes/basic/images',
      caption: 'my data grid'
  });
  
  jQuery("#list").jqGrid('navGrid', '#pager', {add: false, edit: false, del: false},
                         {}, {}, {}, { multipleSearch: true, overlay: false });
  //jQuery("#list").jqGrid('filterToolbar', {stringResult:true, searchOnEnter:true});
  jQuery("#list").jqGrid('navButtonAdd', '#pager',
                        { caption: "Finding", title: "Toggle Search Bar",
                          buttonicon: 'ui-icon-pin-s',
                          onClickButton: function() { $("#list")[0].toggleToolbar() }
                        });
  
  jQuery("#list").jqGrid = {
      search : {
          caption: "Search...",
          Find: "Find",
          Reset: "Reset",
          odata : ['equal', 'not equal','contains'],
          groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ],
          matchText: " match",
          rulesText: " rules"
      }
  }                              
  
  });
  </code></pre>
  
  <p>two things paging is not coming up 
  and search although I have the search window opening with just hte column1 as an option and when clicking the find it seems like it loads the  grid but actually without matching my value that I type in the text box.</p>
  
  <p><strong>UPDATED:</strong> as you can see I made an attempt with the serach argument that did not succeed thanks again for your help it is appreciated</p>
  
  <pre><code>//public ActionResult DynamicGridData(string sidx, string sord, int page, int rows,bool search, string fieldname,string fieldvalue)
  public ActionResult DynamicGridData(string sidx, string sord, int page, int rows)
  {
      var context = new  AlertsManagementDataContext();
      int pageIndex = Convert.ToInt32(page) - 1;
      int pageSize = rows;
      int totalRecords = context.Alerts.Count();
      int totalPages = (int)Math.Ceiling((float)totalRecords / (float)pageSize);
  
      IQueryable&lt;Alert&gt; alerts = null;
      try
      {
         //if (!search)
         //{
             alerts = context.Alerts.
             OrderBy(sidx + " " + sord).
             Skip(pageIndex * pageSize).
             Take(pageSize);
         //}
         //else
         //{
         //    alerts = context.Alerts.Where (fieldname +"='"+ fieldvalue +"'").
         //    Skip(pageIndex * pageSize).
         //    Take(pageSize);
         //}
      }
      catch (ParseException ex)
      {
          Response.Write(ex.Position + "  " + ex.Message + "  " + ex.Data.ToString());
      }
  
      //var alerts =
      //    from a in context.Alerts
      //    orderby sidx ascending
      //    select a;
  
      var jsonData = new {
          total = totalPages,
          page = page,
          records = totalRecords,
  
          rows = (
            from alert in alerts
  
            select new {
              id = alert.AlertId,
              cell = new string[] {
                  "&lt;a href=Home/Edit/"+alert.AlertId +"&gt;Edit&lt;/a&gt; " +"|"+
                      "&lt;a href=Home/Details/"+alert.AlertId +"&gt;Detail&lt;/a&gt; ",
                  alert.AlertId.ToString() ,
                  alert.Policy.Name ,
                  alert.PolicyRule ,
                  alert.AlertStatus.Status ,
                  alert.Code.ToString() ,
                  alert.Message ,
                  alert.Category.Name}
          }).ToArray()
      };
  
      return Json(jsonData);
  }
  </code></pre>