简体   繁体   English

渲染/调用.aspx页面html到另一个.aspx页面

[英]render / call .aspx page html into another .aspx page

in my application, i have implemented ajax 4.0 client templates 在我的应用程序中,我已经实现了ajax 4.0客户端模板

currently my templates resides on same .aspx page. 目前,我的模板位于同一.aspx页上。 (say Main.aspx) (例如Main.aspx)

but i want to externalize them.(ie all the HTML would go on another page) 但我想将它们外部化。(即所有HTML都将放在另一页上)

for that i have used $.get() like 为此,我已经使用$ .get()

$.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 现在,我想让Module中的 getTemp函数将与参数“ TemplateName ”具有相同名称的页面的HTML (即该页面包含的内容)返回到Main.aspx页面(在控制器中使用c#)中。 aspx页包含并从Main.aspx页调用(以上)函数时返回

pls help 请帮助

Have you tried using a partial view to return the html? 您是否尝试过使用局部视图返回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. 然后,您将能够使用“ / Templates / TemplateName”之类的路由来获取$ .get调用中的html。 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. 如果模板每次页面加载仅更改一次,那么我很想将参数推送到要在视图模型中使用的action方法中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM