I have a Mvc app that I am replacing some hard rendered tables with jqGrid [XML].
Problem is I have action links in one of my columns to perform certain actions on the rows. I have these duplicated using CDATA tags in my XML; however the problem is that now this tag is generated in an action method so all the HTML is in my controller (in a TagBuilder) and this is decidedly NOT good.
I was going to look into the RenderPartialExtensions but you need an HtmlHelper instance for that, plus I am using the brail view engine so I am not even sure that would work.
How have other people handled this?
I guess I could create a view that renders the actual xml like html but then I would need to create a view for each xml data source and I already have those.
Thank you in advance for your input.
To clarify more of the architecture and how I ended up solving it. I have the following projects / assemblies:
The VB XML assembly handles serializing the business objects dealing with only the business (#1) model. So i would output an XElement something like this:
The problem arises that I am using jqGrid and I need to add elements to each invoice to certain actions so I need something like:
I got it to work but I had to generate all the actionHtml in the controller which is obviously not a good separation of concerns and I lost all my HtmlHelper methods and such. So how I ended up solving it the ‘correct’ way is:
invoice.ToXml().Elements().ToString()and I am good.To further make this more reusable I created a jqGrid master page that has all the record counts and such in content areas so I can just pass that information in on the actual pages and just worry about outputting the element data.