views:

199

answers:

1

in my application, i have implemented ajax 4.0 client templates

currently my templates resides on same .aspx page. (say Main.aspx)

but i want to externalize them.(ie all the HTML would go on another page)

for that i have used $.get() like

$.get("/Module/getTemp/" + TemplateName, function(result) {...

now, i want getTemp function in Module to return the HTML (ie whatever that page contains) of the page having same name as Parameter 'TemplateName' has into Main.aspx page (use c# in controller) its like.. copy what other .aspx page contains and return it in calling (above)function from Main.aspx page

pls help

A: 

Have you tried using a partial view to return the html? You can setup a "templates" controller that serves up these templates. You can then have action methods for various templates. You would then be able to use routes like "/Templates/TemplateName" to fetch the html in your $.get call. If the template is only going to change once per page load, then I would be tempted to push parameters to my action method to be used in a view model.

rcravens