惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Forbes - Security
Forbes - Security
T
Tailwind CSS Blog
Hugging Face - Blog
Hugging Face - Blog
Blog — PlanetScale
Blog — PlanetScale
WordPress大学
WordPress大学
aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
U
Unit 42
I
InfoQ
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
V
Visual Studio Blog
B
Blog RSS Feed
Vercel News
Vercel News
F
Fortinet All Blogs
Know Your Adversary
Know Your Adversary
T
Troy Hunt's Blog
博客园 - 【当耐特】
MongoDB | Blog
MongoDB | Blog
大猫的无限游戏
大猫的无限游戏
A
About on SuperTechFans
Jina AI
Jina AI
小众软件
小众软件
T
Threatpost
有赞技术团队
有赞技术团队
人人都是产品经理
人人都是产品经理
The Hacker News
The Hacker News
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Microsoft Azure Blog
Microsoft Azure Blog
Recent Announcements
Recent Announcements
酷 壳 – CoolShell
酷 壳 – CoolShell
Scott Helme
Scott Helme
B
Blog
腾讯CDC
Last Week in AI
Last Week in AI
P
Proofpoint News Feed
S
Schneier on Security
N
News and Events Feed by Topic
Microsoft Security Blog
Microsoft Security Blog
K
Kaspersky official blog
G
Google Developers Blog
T
Tor Project blog
PCI Perspectives
PCI Perspectives
S
Secure Thoughts
Google Online Security Blog
Google Online Security Blog
Latest news
Latest news
Google DeepMind News
Google DeepMind News
MyScale Blog
MyScale Blog
罗磊的独立博客

博客园 - format

使用Arduino Nano驱动Lora模块 DIY一个物联网平台:想法 jQuery 批量操作checkbox 国内的maven镜像 Python Flask UnicodeDecodeError 编码错误解决 关于Python的web框架 NHibernate 3 中的 In 集合查询 在MVC 4 中使用自定义Membership [学习][Java] Struts2 与页面传值 (转) C++ Utf8字符转换Gb312编码,解决TinyXml中文乱码 Linux学习 -- Linux的可执行文件 WIN32简单的窗体代码,带函数功能注释 WINSocket编程 发生HTTP GET请求,并接收服务器返回 Win32 API 的文件操作 - format C++ 类中封装Win32API的回调函数 Win32编程 创建从资源文件定义的对话框 Oracle 数据库 用脚本建表空间 WebService调用时候的Object Moved 异常 ICTCLAS 平台调用的封装
把UserControl通过代码控制输入HTML
format · 2010-02-22 · via 博客园 - format

用HttpContext获得Server对象,然后执行Execute方法,看代码:

public string RenderView(UserControl control)
{
   Page page
=new Page();
   Form form
=new Form();

   page.Controls.Add(form);
   StringWriter output 

= new StringWriter();
 
   form.Controls.Add(control);
   HttpContext.Current.Server.Execute(page, output, 
false);
 
   
return output.ToString();
}

如果是不需要在Form中的控件,我们可以省去添加Form这一步。