Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a rich text box in share point 2010 visual web part...i want to get only first 2 lines of the rich text box..any suggestions? i tried getting the line by using cRichtextbox.Lines but it throws an error saying

microsoft.sharepoint.webcontrols.inputformtextbox does not contain defination for lines

share|improve this question

1 Answer 1

up vote 3 down vote accepted

You should use Text property of the InputFormTextBox control, and parse the first two lines manually. It's quite easy actually, something like this:

var firstTwoLines = String.Join("\n", MyRichTextBox.Text.Split('\n').Take(2).ToArray());
share|improve this answer
    
Excellent! this is what i was looking for –  spStacker Jan 31 '12 at 22:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.