13. April 2009
asp.net , vb.net
In this post I will share with you a small code snippet which will help you to get the repeater control output in string variable.
1: Dim sb As New StringBuilder()
2: Dim objHtml As New HtmlTextWriter(New System.IO.StringWriter(sb))
4: If dt.Rows.Count > 0 Then
5: Repeater1.DataSource = dt
7: End If
10: Return sb.ToString()
Well, I have used a little trick here. The RenderControl method of repeater control can put all the HTML in HtmlTextWriter Object and from HtmlTextWriter Object we have simply dump the output the to the string builder. That’s it ….