Remove HTML Tages from Datatable In C#


First Create This Function.

 Public string RemoveHTMLTags(string source)
 {
        return Regex.Replace(source, "<.*?>", string.Empty);
 }


And Then use like this
----------------------------

// Data Stored in DataTable
if (dt.Rows.Count > 0)
{
string strterm = Convert.ToString(dt.Rows[0]["term"].ToString());
strterm = RemoveHTMLTags(strterm);
}
else
{

}

Comments

Popular posts from this blog

Tree view in winforms using c#

how to Replace null value with 0 Using C#

how to fetch all HTML Table Records and modify all records accordingly using jquery and Javascript