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 to share
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 to share