multiple resultsets in c# MVC


I am using Asp.NET MVC as a basic webservice for several searchengine type asp/ jquery sites. Database searching is straightforward:

Model - Sql Server FullText Sproc returning XML

View - N/a

Controller - Authorise user/ Parse input return Content (Model.XML)

The returned XML contains four resultsets - item list, category breakdown, related/ads items & paging numbers. The item, category & related lists all comprise several elements and attribs.

I am now looking for the best method to display the same info in an MVC view - both full and partials for jquery use - but am struggling to find the best solution. The only two I have come up with so far are to parse the XML using Linq ( should this be done in View or Controller?) or have a SProc returning resultsets and use NextResult method to fill multiple lists ( not that I 've worked out how to do that yet....)

All suggestions appreciated, thanks!


For parsing the xml - how about using XmlSerializer to deserialize an object graph?

Does it need to return xml? How about returning regular grids, that you can read over directly? For example, one option is to use ORM such as a LINQ-to-SQL DataContext - then you can just execute the generated method which gives you the data as objects.

Alternatively - perhaps render the xml via an xsl transform? might work as well

By : David

This video can help you solving your question :)
By: admin