Попробуй, работает как чемпион для получения сгенерированной разметки из пользовательского элемента управления
Dim controlText As String = String.Empty
controlText = Me.GenerateControlMarkup("/SampleUserControl/Grid.ascx")
Public Class SacrificialMarkupPage
Inherits Page
Public Overloads Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
End Sub
End Class
Private Function GenerateControlMarkup(ByVal virtualPath As String) As [String]
Dim page As New SacrificialMarkupPage()
Dim ctl As UserControl = DirectCast(page.LoadControl(virtualPath), UserControl)
page.Controls.Add(ctl)
Dim sb As New StringBuilder()
Dim writer As New StringWriter(sb)
page.Server.Execute(page, writer, True)
Return sb.ToString()
End Function