I have a question regarding how to fetch a value from list item to a MultiLine textBox. I have tried alot. First time it gave the correct data. and still it gives the correct data however it also fetches the div tags along with the data. Any thoughts if any please help.
Here is my code:
Register.aspx
<tr>
<td>
<asp:Label ID="Label3" runat="server" Text="Prerequisite"></asp:Label>
</td>
<td>
<asp:TextBox ID="TxtPrerequisite1" runat="server" TextMode="MultiLine" ReadOnly="true"></asp:TextBox>
</td>
</tr>
Register.aspx.cs
string oPrerequisite = null;
SPSite oSPSiteCollection = SPContext.Current.Site;
SPWeb oSPWeb = SPContext.Current.Web;
SPList oSPList1 = oSPWeb.Lists["Scheduled Courses"];
SPListItemCollection oItemCollectionCourse = oSPList1.Items;
foreach (SPListItem ospListItemCourse in oItemCollectionCourse)
{
oPrerequisite = ospListItemCourse["Prerequisite"].ToString();
TxtPrerequisite1.Text = oPrerequisite;
}
The actual out put i am getting is :
<div class="ExternalClassEAA502F55D7B4F9BBA347E2137621D8A"><p> Correct Value is here >div </p></div>
Where as the expected output is:
Correct Value is here
How can I remove the tag from the correct answer so I have only value.
Try SPHttpUtility.ConvertSimpleHtmlToText