web 2.0

Get Repeater Control Output in String

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))
   3:  
   4: If dt.Rows.Count > 0 Then
   5:     Repeater1.DataSource = dt
   6:     Repeater1.DataBind()
   7: End If
   8:  
   9: Repeater1.RenderControl(objHtml)
  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 ….

Comments

Software Testing India India, on 6/6/2009 2:04:36 AM Said:

Software Testing India

Thanks for sharing very useful information and nice blog too.

Hotel GDS United States, on 9/19/2009 7:19:11 AM Said:

Hotel GDS

Aw, this was a really quality post. In theory I'd like to write like this too - taking time and real effort to make a good article... but what can I say... I procrastinate alot and never seem to get something done.

debt loan United States, on 9/19/2009 7:40:26 AM Said:

debt loan

There are certainly a lot of details like that to take into consideration. That is a great point to bring up. I offer the thoughts above as general inspiration but clearly there are questions like the one you bring up where the most important thing will be working in honest good faith. I don?t know if best practices have emerged around things like that, but I am sure that your job is clearly identified as a fair game.

mortgage broker leads United States, on 9/20/2009 3:00:31 PM Said:

mortgage broker leads

Keep 'em coming... you all do such a great job at such Concepts... can't tell you how much I, for one appreciate all you do!

Music Lyrics United States, on 9/23/2009 2:21:34 PM Said:

Music Lyrics

That is some inspirational stuff. Never knew that opinions could be this varied. Thanks for all the enthusiasm to offer such helpful information here.

wireless cycle computer United States, on 9/29/2009 4:42:46 AM Said:

wireless cycle computer

I was very pleased to find this site.I wanted to thank you for this great read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post.

provillus liquid United States, on 9/30/2009 5:01:33 AM Said:

provillus liquid

Excellent read, I just passed this onto a colleague who was doing a little research on that. And he actually bought me lunch because I found it for him smile So let me rephrase that: Thanks for lunch!

Currency Converter Calculator United States, on 10/1/2009 3:23:59 PM Said:

Currency Converter Calculator

Dude.. I am not much into reading, but somehow I got to read lots of articles on your blog. Its amazing how interesting it is for me to visit you very often.

Binary Options United States, on 10/5/2009 2:27:32 PM Said:

Binary Options

You got a really useful blog I have been here reading for about an hour. I am a newbie and your success is very much an inspiration for me.

Aloe Vera Forever United States, on 10/6/2009 12:12:51 PM Said:

Aloe Vera Forever

The beauty of these blogging engines and CMS platforms is the lack of limitations and ease of manipulation that allows developers to implement rich content and 'skin' the site in such a way that with very little effort one would never notice what it is making the site tick all without limiting content and effectiveness.

Andy Beveridge United Kingdom, on 10/14/2009 6:25:33 PM Said:

Andy Beveridge

I keep collecting these little code snippets from around the net, and then forget what they were supposed to do.
Thanks for the post.

cocktail dresses United States, on 10/30/2009 3:01:28 AM Said:

cocktail dresses

I got to read lots of articles on your blog. Its amazing how interesting it is for me to visit you very often.

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading