Byte My Data

A personal collection of advice and solutions I've used.

About the author

Something about the author

Add a new line in a label control within a sharepoint webpart edit/config form

I was creating a webpart and creating some custom edit values and I wanted to add a label for the dropdownlists I was adding.

Adding the label before the dropdown was fine but I needed the dropdown on the next line. I tried using "<br/>" but that gave me an error when I tried to build it in visual studio.

I tried System.Environment.NewLine but that didn't work and I tried "\n" with no luck and "\r\n" gave me an error when I tried to edit the webpart settings.

I noticed that it seemed like the webpart error was being thrown whenever I had a slash combination in the text (i.e. "\r", "</...>") so I tried the non-html compliant "<br>" tag and that finally worked.

Using this worked as well.

 myControl.Add(new LiteralControl("

"))

Categories: ASP.NET | SharePoint
Permalink | Comments (2) | Post RSSRSS comment feed

Comments

Exam Questions Poland

Saturday, February 11, 2012 11:13 AM

Exam Questions

Nice blog indeed. I will always go back for your nice updates, Thank You for posting great articles with useful and up to date topics. I really appreciate your efforts in doing so! I hope to read more interesting topics from your blog!

PassForSure Netherlands

Saturday, February 11, 2012 11:15 AM

PassForSure

Really appreciate this post. It’s hard to sort the good from the bad sometimes, but I think you’ve nailed it!!!  Very important topic and you just did an amazing job presenting it in a simple and clear manner.

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading