SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
SPWeb web = SPContext.Current.Web;
SPList list = web.Lists.TryGetList(DropDownListSelectCategory.SelectedItem.Value);

  SPListItemCollection items = list.GetItems();

   foreach (SPListItem news in items)
   {                        
      TextBoxContents.Text = news["Contents"].ToString();
   }

I Have written following code i get this in my textbox

<div class="ExternalClass59460DDBFF63443BA0E2D2715A82F7DD">TTTTEEEEXXXT</div>

share|improve this question

is the textbox a rich text field instead of a standard textbox?

if it is you need to change itemstyle.xsl and add the following:

<div class="description">
     <xsl:value-of select="@Body" disable-output-escaping="yes" />
</div>

That should solve your styling issue, what you see is ment to be hidden :)

http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopmentlegacy/thread/9649edea-fb87-456b-a43d-40e730a698f8/

or through code use regex

Regex.Replace(currentItem["Your Field Name"].ToString(), "<.*?>", string.Empty);

http://www.go4sharepoint.com/Forum/externalclass-enhanced-rich-text-fields-7091.aspx

and

http://www.sp-blogs.com/blogs/adnan/Lists/Posts/Post.aspx?ID=15

hope it helps :)

share|improve this answer

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.