How do you get the size of a string? In Windows Forms it\'s easy, I just use graphics object and then MeasureString function. In ASP.NET I\'m not sure how to do this.
If you are using JQuery, see this answer
Determine Pixel Length of String in Javascript/jQuery?
I'm sure if not you can work something similar.
You can use the Length property on a string as follows:
http://www.dotnetperls.com/string-length