• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IHtmlString类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IHtmlString的典型用法代码示例。如果您正苦于以下问题:C# IHtmlString类的具体用法?C# IHtmlString怎么用?C# IHtmlString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IHtmlString类属于命名空间,在下文中一共展示了IHtmlString类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CacheRenderedTag

        internal static void CacheRenderedTag(string virtualPath, IHtmlString renderedTag)
        {
            RenderedTags[virtualPath] = renderedTag;

            var ctx = HttpContext.Current;
            var physicalPath = ctx.Server.MapPath(virtualPath);
            if (File.Exists(physicalPath))
            {
                // add file watcher
                var fsw = new FileSystemWatcher(
                    Path.GetDirectoryName(physicalPath), Path.GetFileName(physicalPath));
                FileSystemWatchers.Add(fsw);

                // remove from lookup on change, to allow for creation of new md5 hash
                fsw.Renamed += (sender, args) =>
                {
                    RenderedTags.Remove(virtualPath);
                };
                fsw.Changed += (sender, args) =>
                {
                    RenderedTags.Remove(virtualPath);
                };
                fsw.Deleted += (sender, args) =>
                {
                    RenderedTags.Remove(virtualPath);
                };
                fsw.Created += (sender, args) =>
                {
                    RenderedTags.Remove(virtualPath);
                };

                fsw.EnableRaisingEvents = true;
            }
        }
开发者ID:carsales,项目名称:johnnycache,代码行数:34,代码来源:Common.cs


示例2: InsertAttributes

    /// <summary>
    /// Inserts the given attributes at the end of all opening tags in this HtmlString.
    /// </summary>
    /// <param name="htmlString">The HTML string.</param>
    /// <param name="attributeValues">The attribute values.</param>
    /// <exception cref="System.NullReferenceException"></exception>
    /// <exception cref="System.ArgumentException">No opening tag in IHtmlString: {0} + html;htmlString</exception>
    private static IHtmlString InsertAttributes(IHtmlString htmlString, IEnumerable<Tuple<string, object>> attributeValues)
    {
        if (htmlString == null) throw new NullReferenceException();

        var attributes = new StringBuilder();
        foreach (var t in attributeValues)
        {
            attributes.AppendFormat(" {0}=\"{1}\"",
                HttpUtility.HtmlEncode(t.Item1).ToLower(),
                HttpUtility.HtmlEncode((t.Item2 ?? String.Empty).ToString()));
        }

        var html = htmlString.ToHtmlString();

        var matches = GetOpeningTagMatches(html);
        if (matches.Count == 0)
            throw new ArgumentException("No opening tag in IHtmlString: {0}" + html, "htmlString");

        foreach (Match match in matches)
        {
            var endOfOpeningTag = match.Groups[3].Index;
            html = html.Insert(endOfOpeningTag, attributes.ToString());
        }

        return new HtmlString(html);
    }
开发者ID:raziqyork,项目名称:UsefulCode,代码行数:33,代码来源:HtmlStringExtensions.cs


示例3: HasTag

 protected bool HasTag(IHtmlString html, string tag)
 {
     var doc = new HtmlDocument();
     doc.LoadHtml(html.ToHtmlString());
     var xpath = "//" + tag;
     return doc.DocumentNode.SelectSingleNode(xpath) != null;
 }
开发者ID:jv9,项目名称:MvcReportViewer,代码行数:7,代码来源:IframeTests.cs


示例4: Concact

 public static IHtmlString Concact(this IHtmlString html, IHtmlString other)
 {
     StringBuilder sb = new StringBuilder();
     sb.Append(html.ToString());
     sb.Append(other.ToString());
     return new HtmlString(sb.ToString());
 }
开发者ID:cairabbit,项目名称:daf,代码行数:7,代码来源:HtmlStringExtensions.cs


示例5: FlowFormField

        public FlowFormField(TextWriter writer, bool containsSection, string labelHtml, string elementHtml, string errorHtml = "", bool isValid = true, IHtmlString hint = null, string tip = null, bool hideTip = true, string hintClass = null, string parentClass = null, bool displayFieldName = true)
        {
            _containsSection = containsSection;
            _writer = writer;

            var generatedSection = HelperDefinitions.BeginField(containsSection, displayFieldName ? new HtmlString(labelHtml) : null, new HtmlString(elementHtml), new HtmlString(errorHtml), isValid, hint, tip, hideTip, hintClass, parentClass);
            _writer.Write(generatedSection.ToHtmlString());
        }
开发者ID:SharePointSusan,项目名称:Research-Data-Manager,代码行数:8,代码来源:FlowFormField.cs


示例6: Truncate

 public static object Truncate(IHtmlString htmlString, int length)
 {
     if (htmlString.ToHtmlString().Length <= length)
     {
         return htmlString.ToHtmlString();
     }
     return htmlString.ToHtmlString().Substring(0, length) + "...";
 }
开发者ID:fitba,项目名称:km-2013-projects-team-majevica,代码行数:8,代码来源:HtmlHelpers.cs


示例7: LabelAndControl

 public LabelAndControl(ViewContext viewContext, string labelFor, string labelText, IHtmlString control)
 {
     _labelFor = labelFor;
     _labelText = labelText;
     _control = control;
     _formLayout = viewContext.TempData["BootstrapFormLayout"].ToString();
     HtmlAttributes["class"] = "control-group";
 }
开发者ID:jordanwallwork,项目名称:bootstrapextensions,代码行数:8,代码来源:LabelAndControl.cs


示例8: CreateField

        public static IHtmlString CreateField(this HtmlHelper html, string title, IHtmlString input, IHtmlString validation = null)
        {
            var result = string.Format(@"<div class=""control-group""><label for=""control-label"">{0}</label><div class=""controls"">{1}</div></div>", title, input);
            if (validation != null) {
                result = string.Format(@"<div class=""control-group""><label for=""control-label"">{0}</label><div class=""controls"">{1}<p>{2}</p></div></div>", title, input, validation);
            }

            return new HtmlString(result);
        }
开发者ID:tylermercier,项目名称:mvc_template,代码行数:9,代码来源:HtmlHelpers_Forms.cs


示例9: BeginSection

public static System.Web.WebPages.HelperResult BeginSection(IHtmlString title, IHtmlString leadingHtml, HtmlAttributes htmlAttributes) {
#line default
#line hidden
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {

#line 14 "..\..\Templates\HtmlHelpers.cshtml"
                                                                                                 


#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "    <fieldset");


#line 15 "..\..\Templates\HtmlHelpers.cshtml"
WriteTo(__razor_helper_writer, htmlAttributes);


#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, ">\r\n");

WriteLiteralTo(__razor_helper_writer, "        <legend>");


#line 16 "..\..\Templates\HtmlHelpers.cshtml"
WriteTo(__razor_helper_writer, title);


#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "</legend>\r\n");

WriteLiteralTo(__razor_helper_writer, "        ");


#line 17 "..\..\Templates\HtmlHelpers.cshtml"
WriteTo(__razor_helper_writer, leadingHtml);


#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "\r\n");

WriteLiteralTo(__razor_helper_writer, "        <dl>\r\n");


#line 19 "..\..\Templates\HtmlHelpers.cshtml"


#line default
#line hidden
});

#line 19 "..\..\Templates\HtmlHelpers.cshtml"
}
开发者ID:Royce,项目名称:ChameleonForms,代码行数:56,代码来源:HtmlHelpers.generated.cs


示例10: ActionLink

 public static MvcHtmlString ActionLink(this HtmlHelper htmlHelper,
                                        IHtmlString linkText,
                                        string actionName,
                                        string controllerName,
                                        RouteValueDictionary routeValues,
                                        IDictionary<string, Object> htmlAttributes)
 {
     var linkString = htmlHelper.ActionLink(guid, actionName, controllerName, routeValues, htmlAttributes);
     return ReplaceGuidWithRealText(linkText.ToString(), linkString);
 }
开发者ID:JWroe,项目名称:HelperLibrary,代码行数:10,代码来源:HtmlExtensions.cs


示例11: RenderSection

        public HelperResult RenderSection(string name, IHtmlString defaultContents)
        {
            if (this.IsSectionDefined(name))
            {
                return this.RenderSection(name);
            }

            var result = new HelperResult((x) => x.Write(defaultContents.ToString()));
            return this.RenderSection(name, (x) => result);
        }
开发者ID:nwvdnug,项目名称:NWVDNUGsite,代码行数:10,代码来源:CustomWebViewPage.cs


示例12: Create

 /// <summary>
 /// ����һ��MvcHtmlWrapper�������MvcHtmlWrapper��ֱ�ӷ��أ�
 /// �������������������MvcHtmlWrapper� 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IHtmlWriter类代码示例发布时间:2022-05-24
下一篇:
C# IHtmlNode类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap