1
Answer

MVC - multiple search

Radim Motycka

Radim Motycka

12y
1.6k
1

Hi,Please would you advise?
 

I have table with more columns like username, computername, software,manufacturer etc..And I need to do the search in that way that I create textboxes for each column and when I input for instance "sun" in the manufacturer and "HomeComputer"for the computername it will show me filtered results where the manufacturer is "sun" and computername is "HomeComputer".

Please do you have idea how, or would you share some resources or links where is described something like that ?

For now it works for me only in a single textbox: 

  

       public PartialViewResult SearchSoftware(string q)
        {
            var model = _db.SoftwareAudit.Where(r => r.pSoftwareName.Contains(q) ||              string.IsNullOrEmpty(q));

            return PartialView("_SearchSoftware", model);

        }      

----------------------------------------------------------------------------------------

<p>
  @using (Ajax.BeginForm("SearchName", "SoftwareAudit", new AjaxOptions
  {
      UpdateTargetId = "Results",
      HttpMethod = "GET",
      InsertionMode = InsertionMode.Replace
     
  }))
 
  {
      <input type="text" name="q" data-autocomplete="@Url.Action("QuickNameSearch","SoftwareAudit")" />
      <input type="submit" id="buttonSubmit" value="SearchN" />
     
  }
</p>

<table id="Results">

</table><p>
  

Answers (1)