Skip to content
Loading
c# MVC SEARCH function
My "Index.cshtml" page :
  1. @model IEnumerable   
  2. @{  
  3. ViewBag.Title = "IbexPatients Search";  
  4. }  
  5. @{ Layout = null;  
  6. }  
  7.   
  8.   
  9.   
  10. "viewport" content="width=device-width" />  
  11. Index  
  12.   
  13.   
  14. @using (Html.BeginForm("Index""Home", FormMethod.Post))  
  15. {  
  16. "0" cellspacing="0">  
  17.   
  18. "2" align="center">Person Details  
  19.   
  20.   
  21. Account Number:   
  22.   
  23. @Html.TextBox("option""Account Number")  
  24.   
  25.   
  26.   
  27. Medical Record Number:   
  28.   
  29. @Html.TextBox("option""Medical Record Number")  
  30.   
  31.   
  32.   
  33. First Name:   
  34.   
  35. @Html.TextBox("option""First Name")  
  36.   
  37.   
  38.   
  39. Last Name:   
  40.   
  41. @Html.TextBox("option""Last Name")  
  42.   
  43.   
  44.   
  45.   
  46.   
  47. "submit" value="Search" />  
  48.   
  49.   
  50. }  
  51.   
  52.   
  53.   
  54.   
  55.   
  56.   
  57.   
  58.   
  59.   
  60.   
  61.   
  62.   
  63.   
  64.   
  65.   
  66.   
  67.   
  68.   
  69.   
  70. "float:left ; color:darkorange">  
  71.   
  72. @Html.ActionLink("Detailed List""customapp"nullnew { @style = "font-size : larger; color : Blue;" })  
  73.   
  74.   
  • Thank you! I will implement these sources and let you know soon.

  • Sonu Gupta
    Hi,
     
    Visit the following links - 
     
    https://www.aspsnippets.com/Articles/Implement-Search-functionality-in-WebGrid-with-Paging-in-ASPNet-MVC.aspx 
     
    https://www.aspdotnet-suresh.com/2014/12/show-data-from-database-table-content-mvc-4.0-cshtml.html 
     
    https://www.c-sharpcorner.com/article/creating-grid-view-in-asp-net-mvc-with-search-pagination-and-export-to-excel/ 
  • Chittaranjan Swain
    hi palak,
     
     
    Pl refer below links,
     
    https://www.c-sharpcorner.com/UploadFile/219d4d/implement-search-paging-and-sort-in-mvc-5/
    https://www.aspsnippets.com/Articles/Implement-Search-functionality-in-ASPNet-MVC.aspx
    https://stackoverflow.com/questions/40478711/implementing-a-simple-search-function-in-asp-net-mvc