UI积累

1、富文本编辑

HtmlEditor 
<c:FormRow ColumnWidths="90%">
    <Items>
        <c:HtmlEditor runat="server" Label="产品描述" ID="descriptionHtml" 
        ToolBarSet="Full" Editor="ueditor" BasePath="~/third-part/ueditor/" 
        Height="500px">
        </c:HtmlEditor>
    </Items>
</c:FormRow>

2、绑定下拉数据列表

var dt = new dataTable();
coupon1.DataTextField = "name";
coupon1.DataValueField = "id";
coupon1.DataSource = dt;
coupon1.DataBind();
coupon1.Items.Insert(0, new CheerUI.ListItem("请选择一项", "-1"));

3、postman怎么测试上传文件

form-data 选择file,再选择上传的文件进行测试

4、从富文本中提取出纯文字的方法

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;
}

 

发布了18 篇原创文章 · 获赞 0 · 访问量 360
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览