MVC 4 accediendo a la lista de modelos al hacer clic

I have an mvc app where I pass a list to a view. In a most click, I want to be able to render the next item in the last but am having trouble figuring out how to do that efficiently. My approach originally was to use an index i but I realized that one the page is rendered, accessing my model last at i will always leaf to the same result since that item in the list is rendered on page load and can't just be accessed dynamically. Any insight to an approach for this problem?

preguntado el 28 de mayo de 14 a las 12:05

1 Respuestas

The model can't be accessed as it's only used on the server side.

There are a few ways of solving the problem, you can use Knockout.js or similar client side view model components, once the user click on the button just render then next item from the knockout model.

Or use AJAX to retrieve the next value from the back end and then render it to the screen.

Or generate the whole screen and just hide all items from the user and then display them once the user clicks the button

contestado el 28 de mayo de 14 a las 12:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.