tags:

views:

164

answers:

3

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

I am trying to show the navigation buttons for forward and back. I want there to be a form post when these are clicked so that the search text is still passed in. The problem is, the search text is stored in a form that is outside the partial view that the paged list is in and so the controller never finds it.

Any ideas on what I'm missing?

A: 

You can include

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

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

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

Unfortunately my solution requires Javascript/jQuery.

eu-ge-ne
+1  A: 

You could consider passing not only query results but also the search text to partial view via view model.

Alexander Prokofyev
A: 

google appends search text to the url, yahoo and msn too. I'm sure you can do the same and this is the better way :)

zihotki