locked
Displaying Search Results In A WebGrid RRS feed

  • Question

  • User757508358 posted

    Hi,

    I've just followed the Mike's article on this link: https://www.mikesdotnetting.com/article/180/displaying-search-results-in-a-webgrid and it works great for my project.

    The problem is that if the user list the webgrid at some page (ex. page=3), then he enters some text into the search box and hits Submit, the results shown are ok but the grid is still on page=3. I need a reset to page = 1 on every submit.

    How can I reset the paging to page=1 on Submit?

    Thanks,

    Perica

    Wednesday, May 9, 2018 6:24 PM

All replies

  • User36583972 posted

    Hi pericaj,

    How can I reset the paging to page=1 on Submit?

    You can refer the following samples.

    WebGrid in ASP.Net MVC:
    https://www.c-sharpcorner.com/UploadFile/sourabh_mishra1/webgrid-in-Asp-Net-mvc/


    mvc search page example with code:
    http://www.advancesharp.com/blog/1096/mvc-search-page-example-with-code

    Best Regards,

    Yong Lu

    Thursday, May 10, 2018 8:25 AM
  • User757508358 posted

    Hi,

    Thank you very much, but I'm not very experienced with MVC.

    My site is pretty simple and I'm using only Razor mostly with the help I can find at www.mikesdotnetting.com .

    I'm looking for a simple fix (if there is something like that) of the code I mentioned, so I can reset the paging to page=1 on every form Submit.

    Thanks,

    Tuesday, May 15, 2018 11:22 AM
  • User36583972 posted

    HI pericaj,

    I'm looking for a simple fix (if there is something like that) of the code I mentioned, so I can reset the paging to page=1 on every form Submit.

    Could you provide a demo that we can download it.

    Beside, I suggestion you can implement Search functionality in WebGrid with Paging in ASP.Net MVC Razor. It is can solve your problem in a very convenient way.

    Best Regards,

    Yong Lu

    Wednesday, May 16, 2018 4:41 AM