views:

47

answers:

2

I have rendered one of my controls into a string. I want to safely split the html string. I don't want any hanging html tags. I am working on a pagination control adapter.

How can I split my string, around less than a set number of chars) safely taking HTML into account?

+1  A: 

Take a look at HtmlAgilityPack. You can use it to parse and manipulate the html in your string without having to resort to regex.

Chris Pebble
Can you please point me to samples that would suite me?
Daniel A. White
A: 

If you're looking for a nice way to show the HTML code you should try HTML Tidy.
I did not use it with a limitation on the number of charecters per line, but I think HTML Tidy wrap option might get you close to your target.

Dror
I'm doing pagination.
Daniel A. White