asp.net mvc - Inline Template, Assign HTML as string to model Property -
There is no way to do something like this in ASP.NET MVC (2):
< Code> & lt; Table & gt; & Lt; TR & gt; & Lt;% Model.Pager.TemplateNextPage = {% & gt; & Lt; Li & gt; & Lt; A href = {link-next-page} & gt; Next & lt; / A & gt; & Lt; / Li & gt; & Lt;%}% & gt; & Lt;% Model.Pager.TemplatePageNumber = {%> & Lt; Li & gt; & Lt; A href = {link-page-number} & gt; {Number} & lt; / A & gt; & Lt; / Li & gt; & Lt;%}% & gt; & Lt;% Model.Pager.TemplatePageNumberActive = {%> & Lt; Li & gt; {Number} & lt; / Li & gt; & Lt;%}% & gt; & Lt; / TR & gt; & Lt; / Table & gt;
The general idea is to enable designers to specify the template.
Not that "Beta" code is "%>" and "& lt;%" .
& lt;% Model.Pager.TemplateNextPage = {%> & Lt; Li & gt; & Lt; A href = {link-next-page} & gt; Next & lt; / A & gt; & Lt; / Li & gt; & Lt;%}% & gt;
will be translated into ...
Model.Pager.TemplateNextPage = {; Response. Type (" Next
was compiled (e.g., ignoring white space) so it does not actually work.
What you can do, however, use the ASP.Net WebForms control and create a custom one. This aspen will work within the MVC page. Not all facilities work (eg related to the Postback Form), but whatever you want is enough to do.
e.g. A table control is like this:
& lt; Asp: table runat = "server" & gt; & Lt; ASP: TableFooterRow & gt; & Lt; ASP: TableCell & gt; Foo & lt; / ASP: TableCell & gt; & Lt; ASP: TableCell & gt; FAA & lt; / ASP: TableCell & gt; & Lt; / ASP: TableFooterRow & gt; & Lt; / ASP: Tables & gt;
You can extend it - or create controls from scratch so that you can create your own templatePex page.
... but this is not the ASP.Net MVC route - this is the old SPNET webfom. It just works within ASP.Net MVC pages.
You have the second option, to create your own template engine, but this is a lot of work and I think the intellisense part is very important for you as well that it will screw up as well.
Comments
Post a Comment