user989952
user989952

Reputation: 683

.net mvc 4 using razor and json

I am currently working on a .NET MVC 4 project. We have a razor list of items, the razor handles number of items shown and the ordering. We want to then make this client side. Is there a way we can update the razor via json to achieve this?

Thanks in advance

Richard

Upvotes: 0

Views: 63

Answers (2)

stead
stead

Reputation: 167

For client side ordering,paging and filtering I would suggest using a Jquery Grid such as https://datatables.net/

Another option for you may be Kendo Grid

Ive had good experiences with both, although I prefer Kendo as it is a little cleaner when you do not need to do too many crazy things with custom HTML column values.

Upvotes: 0

musefan
musefan

Reputation: 48425

Is there a way we can update the razor via json to achieve this?

No.

Razor syntax is rendered during the request of the page (server side). There is no razor when it comes to client side, so you cannot modify it from client side. And if you could the server would need to re-render it anyway.

You could use AJAX to request a new list of objects (which you could return as JSON), and then you could update your HTML using javascript to reflect that new list. But this is a different question, and you would need to try something for yourself first anyway.

Upvotes: 3

Related Questions