Convert ASP.NET Control to String

xiaoxiao2021-03-06  116

Convert a String of ASP.NET Control: Pro.Net Components From: www.pronetcomponents.com Date: 2004 at 10:10:08 on June 1

The following class can implement the Control of the ASP.NET to convert to String strings, which can be used:

Send an ASP.NET to send ASP.NET to use the XSLT conversion page Output ASPX page global string of global strings for use C # code

using System; using System.IO; using System.Text; using System.Web; using System.Web.UI; public class Render {public static string RenderControl (System.Web.UI.Control control) {StringBuilder result = new StringBuilder ( 1024); control.RenderControl (new HtmlTextWriter (new StringWriter (result))); return result.ToString ();} public static string RenderControl (System.Web.UI.TemplateControl control) {StringBuilder result = new StringBuilder (1024); control.RenderControl (new HtmlTextWriter (new StringWriter (result))); return result.ToString ();} public static string RenderPage (string pageLocation) {System.Web.HttpContext context = System.Web.HttpContext.Current; StringBuilder result = New StringBuilder (1024); context.server.execute (PageLocation, New htmlTextWriter); returnrate.tostring ();}}

VB.NET code

转载请注明原文地址:https://www.9cbs.com/read-99924.html

New Post(0)