1

When I created content for custom list. It is "gegtege". After I create a asp:textbox that calling this field and display "<div class="ExternalClassE7D56B8D72FF4453B3F162CE43ABBF0A">" in txtComment.Text.

I don't understand and how to remove it?

SPWeb webObj = SPContext.Current.Web;
            //SPFolder ManagerSubMainList = webObj.Folders["ManagerSubMainList"];
            //SPFolder AssignerMainList = webObj.Folders["AssignerMainList "];
            SPList listContract = webObj.Lists["MainList"];
            SPListItem thisItem = null;
            if (getId() > 0)
            {
                thisItem = listContract.GetItemById(getId());
                if(!string.IsNullOrEmpty(thisItem["Title"].ToString()))
                {
                    txtTitle.Text = thisItem["Title"].ToString();
                }
                if(!string.IsNullOrEmpty(thisItem["Comment"].ToString()))
                {
                    txtComment.Text = thisItem["Comment"].ToString();
                }


                //thisItem.Update();
            }

2 Answers 2

1

In your list, make sure that the Multiple lines of text column setting is set to plain text

  • Go to list setting
  • click on the column name.
  • Beside Additional Column Settings, Check Plain text
0

Try below code:

SPWeb webObj = SPContext.Current.Web;
//SPFolder ManagerSubMainList = webObj.Folders["ManagerSubMainList"];
//SPFolder AssignerMainList = webObj.Folders["AssignerMainList "];
SPList listContract = webObj.Lists["MainList"];
SPListItem thisItem = null;
if (getId() > 0)
{
    thisItem = listContract.GetItemById(getId());
    if(!string.IsNullOrEmpty(thisItem["Title"].ToString()))
    {
        txtTitle.Text = thisItem["Title"].ToString();
    }
    if(!string.IsNullOrEmpty(thisItem["Comment"].ToString()))
    {
        string comment = thisItem["Comment"].ToString();
        txtComment.Text = SPHttpUtility.ConvertSimpleHtmlToText(comment, comment.Length);       
    }

    //thisItem.Update();
}

Reference - SPHttpUtility.ConvertSimpleHtmlToText

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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