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

Any clue why i get the output in my textbox_moreinformation look like this?:

COLUMN VALUE

I'm working with two webparts, the provder webparts values i want to display on my consumer, and i only want my output to contain the column value, not the div tags!

Code in provder, button_edit:

    protected void Button_Edit_Click(object sender, EventArgs e)
    {  
        if (ListBox_List.SelectedItem != null)
        {
            WP_ConsumerSearchListUserControl control = (WP_ConsumerSearchListUserControl)Page.LoadControl(@"~/_CONTROLTEMPLATES/Kingen.Artifacts.WebParts/WP_ConsumerSearchList/WP_ConsumerSearchListUserControl.ascx");
            control.GetProduct(ListBox_List.SelectedValue);
            Controls.Add(control);
        }
    }

In my consumer...ascx:

    public void GetProduct(string prodNum)
    {
        SPWeb web = SPContext.Current.Web;
        SPList prodList = web.Lists.TryGetList("Extern Products");

        if (prodList != null)
        {
            SPQuery query = new SPQuery();
            query.Query =
                string.Format(
                    "<Where><BeginsWith><FieldRef Name='ProductNumber' /><Value Type='Text'>{0}</Value></BeginsWith></Where>",
                    prodNum);
            query.ViewFields = "";

            SPListItemCollection items = prodList.GetItems(query);

            foreach (SPListItem listItem in items)
            {
                TextBox_NameList.Text = listItem["Title"] !=null ? listItem["Title"].ToString() : string.Empty;
                TextBox_ListPriceList.Text = listItem["ListPrice"] !=null ? listItem["ListPrice"].ToString() : string.Empty;
                TextBox_ProdNumList.Text = listItem["ProductNumber"] != null ? listItem["ProductNumber"].ToString() : string.Empty;
                TextBox_ColorList.Text = listItem["Color"] !=null ? listItem["Color"].ToString() : string.Empty;
                TextBox_MoreInformationList.Text = listItem["MoreInformation"] !=null  ? listItem["MoreInformation"].ToString() : string.Empty;
            }
        }
    }

Kind regards, Kristian

share|improve this question
add comment

3 Answers 3

I suppose the MoreInformation column is a RichText field. If yes, you might want to try the way is described on this blogpost.

I find it pretty clear, but if you need more help, please feel free to ask.

I hope it helped.

share|improve this answer
add comment

Nobert's URL will solve the issue but generally I use SharePoint:InputFormTextBox control to show multi-line text field in Visual Web Parts!

And usually there is a problem that you cannot change the width of this control, so you can do it using CSS as described in my blog post

I hope this helps!

share|improve this answer
add comment

I changed my column to "Plain text" and it works well now :)

share|improve this answer
    
Well, this is also a solution, but you are loosing functionality too. –  Norbert Nov 30 '12 at 14:07
add comment

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.