本文整理汇总了C#中IHtmlString.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# IHtmlString.ToString方法的具体用法?C# IHtmlString.ToString怎么用?C# IHtmlString.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHtmlString
的用法示例。
在下文中一共展示了IHtmlString.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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());
}
示例2: 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);
}
示例3: 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);
}
示例4: ConfigName
public void ConfigName(IHtmlString name) {
this.FieldNamePrefix = name.ToString();
if (String.IsNullOrEmpty(this.FieldNamePrefix)) {
this.FieldNamePrefix = String.Empty;
} else {
this.FieldNamePrefix = String.Format("{0}.", this.FieldNamePrefix);
}
this.FieldIdPrefix = this.FieldNamePrefix.Replace(".", "_").Replace("]", "_").Replace("[", "_");
}
示例5: PrependHtml
public static TagBuilder PrependHtml(this TagBuilder source, IHtmlString html)
{
return PrependHtml(source, html.ToString());
}
示例6: BeginSection
public static System.Web.WebPages.HelperResult BeginSection(IHtmlString heading, IHtmlString leadingHtml, HtmlAttributes htmlAttributes) {
#line default
#line hidden
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 13 "..\..\Templates\Default\DefaultHtmlHelpers.cshtml"
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, " <fieldset");
#line 14 "..\..\Templates\Default\DefaultHtmlHelpers.cshtml"
WriteTo(__razor_helper_writer, htmlAttributes);
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, ">\r\n");
#line 15 "..\..\Templates\Default\DefaultHtmlHelpers.cshtml"
if (heading != null && !string.IsNullOrWhiteSpace(heading.ToString()))
{
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, " <legend>");
#line 17 "..\..\Templates\Default\DefaultHtmlHelpers.cshtml"
WriteTo(__razor_helper_writer, heading);
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "</legend>\r\n");
#line 18 "..\..\Templates\Default\DefaultHtmlHelpers.cshtml"
}
if (leadingHtml != null && !string.IsNullOrWhiteSpace(leadingHtml.ToString()))
{
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, " ");
#line 21 "..\..\Templates\Default\DefaultHtmlHelpers.cshtml"
WriteTo(__razor_helper_writer, leadingHtml);
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "\r\n");
#line 22 "..\..\Templates\Default\DefaultHtmlHelpers.cshtml"
}
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, " <dl>\r\n");
#line 24 "..\..\Templates\Default\DefaultHtmlHelpers.cshtml"
#line default
#line hidden
});
#line 24 "..\..\Templates\Default\DefaultHtmlHelpers.cshtml"
}
示例7: AssertEqualsIgnoreLineBreaks
private void AssertEqualsIgnoreLineBreaks(string expected, IHtmlString actual) {
Assert.AreEqual(expected, actual.ToString().Replace("\r\n", ""));
}
示例8: Enable
/// <summary>
/// Enables rich text on a given input text.
/// </summary>
/// <param name="input">Input text.</param>
/// <returns>Rich text.</returns>
public static IHtmlString Enable(IHtmlString input)
{
return Enable(input != null ? input.ToString() : string.Empty);
}
示例9: RouteLink
public static MvcHtmlString RouteLink(this HtmlHelper htmlHelper, IHtmlString linkText, string routeName, string protocol, string hostName, string fragment, RouteValueDictionary routeValues, IDictionary<string, object> htmlAttributes) {
if (String.IsNullOrEmpty(linkText.ToString())) {
throw new ArgumentException("Argument must be a non empty string", "linkText");
}
return MvcHtmlString.Create(GenerateRouteLink(htmlHelper.ViewContext.RequestContext, htmlHelper.RouteCollection, linkText, routeName, protocol, hostName, fragment, routeValues, htmlAttributes));
}
示例10: ActionLink
public static MvcHtmlString ActionLink(this HtmlHelper htmlHelper, IHtmlString linkText, string actionName, string controllerName, RouteValueDictionary routeValues, IDictionary<string, object> htmlAttributes) {
if (String.IsNullOrEmpty(linkText.ToString())) {
throw new ArgumentException("Argument must be a non empty string", "linkText");
}
return MvcHtmlString.Create(GenerateLink(htmlHelper.ViewContext.RequestContext, htmlHelper.RouteCollection, linkText, null /* routeName */, actionName, controllerName, routeValues, htmlAttributes));
}
示例11: GenerateLinkInternal
private static string GenerateLinkInternal(RequestContext requestContext, RouteCollection routeCollection, IHtmlString linkText, string routeName, string actionName, string controllerName, string protocol, string hostName, string fragment, RouteValueDictionary routeValues, IDictionary<string, object> htmlAttributes, bool includeImplicitMvcValues) {
string url = UrlHelper.GenerateUrl(routeName, actionName, controllerName, protocol, hostName, fragment, routeValues, routeCollection, requestContext, includeImplicitMvcValues);
TagBuilder tagBuilder = new TagBuilder("a") {
InnerHtml = linkText.ToString()
};
tagBuilder.MergeAttributes(htmlAttributes);
tagBuilder.MergeAttribute("href", url);
return tagBuilder.ToString(TagRenderMode.Normal);
}
示例12: Concat
public static IHtmlString Concat(this IHtmlString firstString, IHtmlString secondString)
{
return new HtmlString(firstString.ToString() + "\r\n" + secondString.ToString());
}
示例13: BeginNestedSection
public static System.Web.WebPages.HelperResult BeginNestedSection(IHtmlString heading, IHtmlString leadingHtml, HtmlAttributes htmlAttributes)
{
#line default
#line hidden
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 27 "..\..\Templates\Default\DefaultHtmlHelpers.cshtml"
if (heading != null && !string.IsNullOrWhiteSpace(heading.ToString()))
{
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, " <dt>");
#line 30 "..\..\Templates\Default\DefaultHtmlHelpers.cshtml"
WriteTo(__razor_helper_writer, heading);
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "</dt>\r\n");
#line 31 "..\..\Templates\Default\DefaultHtmlHelpers.cshtml"
}
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, " <dd>\r\n");
#line 33 "..\..\Templates\Default\DefaultHtmlHelpers.cshtml"
if (leadingHtml != null && !string.IsNullOrWhiteSpace(leadingHtml.ToString()))
{
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, " ");
#line 35 "..\..\Templates\Default\DefaultHtmlHelpers.cshtml"
WriteTo(__razor_helper_writer, leadingHtml);
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, "\r\n");
#line 36 "..\..\Templates\Default\DefaultHtmlHelpers.cshtml"
}
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, " <dl");
#line 37 "..\..\Templates\Default\DefaultHtmlHelpers.cshtml"
WriteTo(__razor_helper_writer, htmlAttributes);
#line default
#line hidden
WriteLiteralTo(__razor_helper_writer, ">\r\n");
#line 38 "..\..\Templates\Default\DefaultHtmlHelpers.cshtml"
#line default
#line hidden
});
#line 38 "..\..\Templates\Default\DefaultHtmlHelpers.cshtml"
}
示例14: BeginNestedSection
public static System.Web.WebPages.HelperResult BeginNestedSection(IHtmlString heading, IHtmlString leadingHtml, HtmlAttributes htmlAttributes)
{
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 29 "..\..\Templates\TwitterBootstrap3\TwitterBootstrapHtmlHelpers.cshtml"
htmlAttributes.AddClass("panel panel-default");
#line default
#line hidden
WebViewPage.WriteLiteralTo(@__razor_helper_writer, " <div");
#line 31 "..\..\Templates\TwitterBootstrap3\TwitterBootstrapHtmlHelpers.cshtml"
WebViewPage.WriteTo(@__razor_helper_writer, htmlAttributes);
#line default
#line hidden
WebViewPage.WriteLiteralTo(@__razor_helper_writer, ">\r\n");
#line 32 "..\..\Templates\TwitterBootstrap3\TwitterBootstrapHtmlHelpers.cshtml"
if (heading != null && !string.IsNullOrWhiteSpace(heading.ToString()))
{
#line default
#line hidden
WebViewPage.WriteLiteralTo(@__razor_helper_writer, " <div class=\"panel-heading\">");
#line 34 "..\..\Templates\TwitterBootstrap3\TwitterBootstrapHtmlHelpers.cshtml"
WebViewPage.WriteTo(@__razor_helper_writer, heading);
#line default
#line hidden
WebViewPage.WriteLiteralTo(@__razor_helper_writer, "</div>\r\n");
#line 35 "..\..\Templates\TwitterBootstrap3\TwitterBootstrapHtmlHelpers.cshtml"
}
#line default
#line hidden
WebViewPage.WriteLiteralTo(@__razor_helper_writer, " <div class=\"panel-body\">\r\n");
#line 38 "..\..\Templates\TwitterBootstrap3\TwitterBootstrapHtmlHelpers.cshtml"
if (leadingHtml != null && !string.IsNullOrWhiteSpace(leadingHtml.ToString()))
{
#line default
#line hidden
#line 40 "..\..\Templates\TwitterBootstrap3\TwitterBootstrapHtmlHelpers.cshtml"
WebViewPage.WriteTo(@__razor_helper_writer, leadingHtml);
#line default
#line hidden
#line 40 "..\..\Templates\TwitterBootstrap3\TwitterBootstrapHtmlHelpers.cshtml"
}
#line default
#line hidden
});
}
示例15: AreEqual
public static void AreEqual(IHtmlString expected, IHtmlString actual)
{
HtmlAssert.AreEqual(expected.ToString(), actual.ToString());
}