Tuesday, January 26, 2010

SPGridView and "Multiple Lines of Text" type in SharePoint.

To remove the div tag from being displayed in SPGridView when displaying data from "Multiple Lines of Text" column type, set the HtmlEncode property of the BoundField to false.

BoundField boundfield = new BoundField();
boundfield.HeaderText = "Description";
boundfield.DataField = "Description";
boundfield.SortExpression = "Description";
boundfield.HtmlEncode = false;

m_GridView.Columns.Add(boundfield);

No comments: