Hi,
I have a Note field called "Description". I am trying to bind a asp.net listbox with the values of the Note field.
I have written the code as below:
SPList testList = oWeb.Lists["ListName"];
SPListItemCollection testListItems = testList.Items;
DataTable dtTestGroup = new DataTable();
if testListItems.Count > 0)
{
dtTestGroup = testListItems.GetDataTable();
lstDesc.DataTextField = "Description";
lstDesc.DataValueField = "Description";
lstDesc.DataSource = dtTestGroup;
lstDesc.DataBind();
}In the UI, now i am seeing the unwanted div tags at the front of the text.
For a normal list item, I can do a regex as below to remove the div entries
Regex.Replace(currentItem["Your Field Name"].ToString(), "<.*?>", string.Empty);
But, when using the "Datatextfield" and "datavaluefield", how to use the regex in the above condition? How to show only the text?
Thanks