如何使用ASP.NET C#在div标签中绑定数据库中的有限richtext? [英] How to bind limited richtext from database in div tag using ASP.NET C#?

查看:85
本文介绍了如何使用ASP.NET C#在div标签中绑定数据库中的有限richtext?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用自由文本框asp.net c#将数据插入数据库,当我在div标签中绑定数据时,整个数据来到并绑定。但我想只显示有限的文字。为此我使用了description.ToString()。SubString(200),它显示了描述中的前200个字符,但问题是它还显示了带有数据的html标签。那么有没有其他解决方案可以像自由文本/ Richtextbox控件的子字符串方法一样工作?



我尝试了什么:



FreeTextBoxDescription.ToString()。SubString(200);

I am using freetext box asp.net c# for inserting the data into database, when i bind that data in div tag the whole data comes and bind. But i want to show only limited text . for this i used description.ToString().SubString(200), It show first 200 characters from the description but the problem is it also shows the html tags with the data. so is there any other solution which works just like substring method for freetext/Richtextbox control?

What I have tried:

FreeTextBoxDescription.ToString().SubString(200);

推荐答案

试试

try
FreeTextBoxDescription.HtmlStrippedText.SubString(200);



参考 HtmlStrippedText Property [ ^ ]


这篇关于如何使用ASP.NET C#在div标签中绑定数据库中的有限richtext?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆