문제

I am currently pulling some data from a SQL Server database into a C# asp.net page.

I am using the following (portion of) code to ouput the HTML text that is stored in my body column:

TextLabel.Text += "<div class=\"newsEntry\">" + 
    Convert.ToString(reader2["body"]).Substring(0, 220) + 
    "...<a href='entry.aspx?ID=" + reader2["ID"] + 
    "' title=\"Read More about " + reader2["Title"] + 
    "\">Read More &raquo;</a></div>";

I'd like to strip the body value (+ Convert.ToString(reader2["body"]).Substring(0, 220) +) of all HTML inside it.

How do I achieve this with C#?

Normally with PHP, I'd use striptags.

Many thanks for any help.

도움이 되었습니까?
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top