我从后台读数据,数据如下:
<p>   <strong>  于坚专栏:道成肉身</strong></p>  <p>   <strong><br />     &mdash;&mdash;最近十年的一点思考</strong></p>  我在页面只要显示:文字,不要标签。怎么办?我数据库层返回的是一个datatable,不能对对象的属性进行操作!

解决方案 »

  1.   

    放个div   div.innerHTML="<p> <strong>  于坚专栏:道成肉身</strong></p> <p><strong><br />   &mdash;&mdash;最近十年的一点思考</strong></p>   "
      

  2.   

    要不你换种方式显示,用其它标签literal
      

  3.   

    div  写个id=“div1”  runnet=“server”   后来直接    div1.innerhtml        标签也显示出来就innertext  你试试看
      

  4.   

    我的意思是:<p> <strong>  于坚专栏:道成肉身</strong></p> <p><strong><br />   &mdash;&mdash;最近十年的一点思考</strong></p>
    这个只显示文字,其他的标签都不要了,
      

  5.   

    <p> <strong>  把这些东西过滤掉吧
      

  6.   

    public static string NoHTML(string Htmlstring)
        {
            //删除脚本  
            Htmlstring = Regex.Replace(Htmlstring, @"<script[^>]*?>.*?</script>", "", RegexOptions.IgnoreCase);
            //删除HTML  
            Htmlstring = Regex.Replace(Htmlstring, @"<(.[^>]*)>", "", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"([\r\n])[\s]+", "", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"-->", "", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"<!--.*", "", RegexOptions.IgnoreCase);        Htmlstring = Regex.Replace(Htmlstring, @"&(quot|#34);", "\"", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(amp|#38);", "&", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(lt|#60);", "<", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(gt|#62);", ">", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(nbsp|#160);", "   ", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(iexcl|#161);", "\xa1", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(cent|#162);", "\xa2", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(pound|#163);", "\xa3", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(copy|#169);", "\xa9", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&#(\d+);", "", RegexOptions.IgnoreCase);        Htmlstring.Replace("<", "");
            Htmlstring.Replace(">", "");
            Htmlstring.Replace("\r\n", "");
            Htmlstring = HttpContext.Current.Server.HtmlEncode(Htmlstring).Trim();        return Htmlstring;
        }