Created
February 11, 2023 05:36
-
-
Save spurgeonbj/a9ed2ba1640d66cb39a45092f0e97bf2 to your computer and use it in GitHub Desktop.
C# Traverse a HTML WebControl to get Inner HTML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HtmlGenericControl myControl = (HtmlGenericControl)this.FindControl("CoursesDataDiv"); | |
StringBuilder sb = new StringBuilder(); | |
using (StringWriter sw = new StringWriter(sb)) | |
{ | |
using (HtmlTextWriter htw = new HtmlTextWriter(sw)) | |
{ | |
myControl.RenderControl(htw); | |
} | |
} | |
string markup = sb.ToString(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment