在服务器控件中加载并呈现.aspx文件 [英] Load and Render a .aspx file in a Server Control

查看:127
本文介绍了在服务器控件中加载并呈现.aspx文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,服务器控件没有.aspx文件.因此,我需要加载一个aspx文件,以使其像服务器控件的模板一样工作,并呈现服务器控件的内容.

As far as I know server controls doesn't have a .aspx file. So I need to load a aspx file in order for it to work like a template for my server control, and render my server control content.

我该怎么做?

推荐答案

您可以创建 Page 类,它们与模板(使用 ascx 扩展名而不是 aspx 的模板)配对.

You can create a User Control: like Page classes, they're paired with templates (that use the ascx extension rather than aspx).

如果必须提供自定义服务器控件,则需要创建自己的模板机制.

If you're obliged to deliver a custom server control instead, you'll need to create your own templating mechanism.

这篇关于在服务器控件中加载并呈现.aspx文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆