I am writing a application in MVC with a existing database. I succesfully connected the DB with EF and through Scaffolding. The tables are displayed in the view.
I wanted Jquery plugin, Datatable for sorting and filtering. But they require the data in JSON format. I looked around and do not find a solid way to convert the values from existing database to JSON.
I see tutorials where WebAPI attributes like DBController and DataService are added and converted to JSON. I cannot able to work it through this way...
SO I was wondering ways of how to convert the values getting in views to JSON..I am sorry if I added lot of unwanted information.
Thanks a lot
If you want to do the JSON conversion in view then you can follow what @Aleksey answered. You told you are using jquery plugin(jquery table?) so you may need controller actions that will return the data to fill the grid as JSON? In this cases you can have actions in controller that returns Json action result and you don't need to do any conversion by directly using JavaScript serializer (this will be done by the framework for you).
For ex.
JsonRequestBehavior.AllowGetyou have to use for GET requests.