1
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>

3

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 :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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