gpt4 book ai didi

asp.net - 如何为 ASP.NET 中的控件检索呈现的 html?

转载 作者:行者123 更新时间:2023-12-01 08:41:45 25 4
gpt4 key购买 nike

如何以编程方式检索为 ASP .NET 中的 Web 控件呈现的 html?

例如:

dim controlHTML as string = myControl.GetHTML()

最佳答案

System.Text.StringBuilder sb = new System.Text.StringBuilder();
using (System.IO.StringWriter sw = new System.IO.StringWriter(sb))
using (System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw))
{
mycontrol.RenderControl(hw);
}

关于asp.net - 如何为 ASP.NET 中的控件检索呈现的 html?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1637593/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com