»Dotnet Ads
»Message Boards
Message Boards
Dotnet Books
»Member Details
Register
Login
LogOut
Submit Code
Submit Jobs
Submit Projects
»Competition
Community
Winners
Prizes
Write For Us
Members
»Other Resources
Links
Dotnet Resources
|
Control to String FormatConverts a web control such as a DataGrid to a string representation
public static string RenderControlToString(System.Web.UI.Control c)
{
StringWriter sw = null;
System.Web.UI.HtmlTextWriter tw = null;
string test;
try
{
sw = new StringWriter();
tw = new System.Web.UI.Html32TextWriter(sw);
c.RenderControl(tw);
return sw.ToString();
}
catch (Exception ex)
{
test = ex.Message;
test += " ( ";
return string.Empty;
}
finally
{
if (null != sw) sw.Close();
sw = null;
if (null != tw) tw.Close();
tw = null;
}
}
|
|