How do I publish values ​​outside of a controller partial view in ASP.NET MVC?

I am working with a paginated list like in the NerdDinner example.

I am trying to show forward and back navigation buttons. I want there to be a form message when they are clicked so that the search text still goes through. The problem is that the search text is stored in a form that is outside of the partial view that the dumped list is in and therefore the controller never finds it.

Any ideas what I am missing?

+1


a source to share


3 answers


You may want to consider passing in not only the query results but also the search text for partial viewing through the view model .



+1


a source


You can enable

<input type="hidden" id="search" />

      

in a form with navigation buttons and fill it on POST with jQuery:



$(document).ready(function() {
    $('.yourNavButtonsClass').click(function () {
        var searchText = $('input#yourSearchTextBoxId').val();
        $('input#search').val(searchText);
    });
});

      

Unfortunately my solution requires Javascript / jQuery.

0


a source


Google adds search text to url, yahoo and msn. I'm sure you can do the same and this is the best way :)

0


a source







All Articles