本文整理汇总了C#中HtmlTags.HtmlTag.Append方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlTag.Append方法的具体用法?C# HtmlTag.Append怎么用?C# HtmlTag.Append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HtmlTags.HtmlTag
的用法示例。
在下文中一共展示了HtmlTag.Append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Menu
public static HtmlTag Menu(this IFubuPage page, string menuName = null)
{
var navigationService = page.Get<INavigationService>();
var securityContext = page.Get<ISecurityContext>();
var items = navigationService.MenuFor(new NavigationKey(menuName ?? StringConstants.BlogName));
var menu = new HtmlTag("ul");
items.Each(x =>
{
var link = new LinkTag(x.Key, x.Url);
var li = new HtmlTag("li");
if (x.Key.Equals("Logout") && x.MenuItemState == MenuItemState.Available)
{
var spanTag = new HtmlTag("span");
spanTag.Text(string.Format("Welcome, {0}", securityContext.CurrentIdentity.Name));
menu.Append(spanTag);
}
if (x.MenuItemState == MenuItemState.Active)
li.AddClass("current");
if(x.MenuItemState == MenuItemState.Active || x.MenuItemState == MenuItemState.Available)
menu.Append(li.Append(link));
});
return menu;
}
示例2: AwesomeDisplay
public static string AwesomeDisplay(this IFubuPage page, object model)
{
var type = model.GetType();
var result = new StringBuilder();
var tags = page.Tags(model);
var sl = page.Get<IServiceLocator>();
tags.SetProfile(AwesomeConfiguration.TagProfile);
var tr = new HtmlTag("tr");
foreach (var prop in getProperties(type))
{
var p = new SingleProperty(prop, type);
var elementRequest = new ElementRequest(model, p, sl);
var accessRight = page.Get<IFieldAccessService>().RightsFor(elementRequest);
HtmlTag display = tags.DisplayFor(elementRequest).Authorized(accessRight.Read);
var td = new HtmlTag("td").Append(display);
tr.Append(td);
}
var editLink = new LinkTag("Edit", page.EditUrlFor(model));
tr.Append(new HtmlTag("td").Append(editLink));
var deleteLink = new LinkTag("Delete", page.DeleteUrlFor(model));
tr.Append(new HtmlTag("td").Append(deleteLink));
result.Append(tr.ToString());
return result.ToString();
}
示例3: writeScripts
private void writeScripts(HtmlTag foot)
{
// Do this regardless
foot.Append(_assets.For("FubuDiagnostics.js").ToEmbeddedScriptTag());
var routeData = _routeWriter.WriteJavascriptRoutes("FubuDiagnostics.routes", _routes);
foot.Append(routeData);
var extensionFiles = _assets.JavascriptFiles().Where(x => x.AssemblyName != "FubuMVC.Core");
if (_runtime.Mode.InDiagnostics())
{
var names = _scripts.Union(extensionFiles.Select(x => x.Name.Split('.').Reverse().Take(2).Reverse().Join(".")));
var links = _tags.BuildScriptTags(names.Select(x => "fubu-diagnostics/" + x));
links.Each(x => foot.Append(x));
}
else
{
_scripts.Each(name =>
{
var file = _assets.For(name);
foot.Append(file.ToEmbeddedScriptTag());
});
extensionFiles.Each(file => foot.Append(file.ToEmbeddedScriptTag()));
}
}
示例4: BootstrapLayout
public BootstrapLayout()
{
_containingDiv = new HtmlTag("div").AddClass("control-group");
_labelPlaceholder = new HtmlTag("div");
_inputContainer = new HtmlTag("div").AddClass("controls");
_containingDiv.Append(_labelPlaceholder);
_containingDiv.Append(_inputContainer);
}
示例5: ToString
public override string ToString()
{
_wrappingDiv = new HtmlTag("div").AddClass("clearfix");
_wrappingDiv.Append(_label);
var d = new HtmlTag("div").AddClass("input");
_inputHolder.Children.Each(c => d.Append(c));
_wrappingDiv.Append(d);
return string.Format("{0}\n", _wrappingDiv);
}
示例6: HtmlTagLabelCheckbox
public static HtmlTag HtmlTagLabelCheckbox(string label, string name, bool value)
{
var d = new HtmlTag("div");
d.Append(new HtmlTag("label").Attr("for", name).Text(label));
if (value)
d.Append(new HtmlTag("input").Attr("type", "checkbox").Id(name).Attr("name", name).Attr("checked", "checked"));
else
d.Append(new HtmlTag("input").Attr("type", "checkbox").Id(name).Attr("name", name).Attr("value", value));
d.Append(new HtmlTag("input").Attr("type", "hidden").Id(name).Attr("name", name).Attr("value", ""));
return d;
}
示例7: Build
public override HtmlTag Build(ElementRequest request)
{
HtmlTag root = new HtmlTag("div");
var selectListItems = request.RawValue as IEnumerable<string>;
if (selectListItems == null) return root;
selectListItems.Each(item=>
{
root.Append(new HtmlTag("span").Text(item));
root.Append(new HtmlTag("br"));
});
return root;
}
示例8: buildControlGroup
private HtmlTag buildControlGroup()
{
var group = new HtmlTag("div").AddClass("control-group");
if (LabelTag != null)
{
group.Append(LabelTag);
}
group.Append(_body);
return group;
}
示例9: get_subscriptions
public HtmlTag get_subscriptions()
{
var div = new HtmlTag("div");
div.Add("h3").Text("Subscription Persistence");
div.Append( new DescriptionBodyTag(Description.For(_persistence)));
div.Add("h3").Text("Nodes");
div.Append(new TransportNodeTableTag(_persistence.AllNodes()));
div.Add("h3").Text("Subscriptions");
div.Append(new SubscriptionStorageTableTag(_persistence.AllSubscriptions()));
return div;
}
示例10: ConfigureFubuMVC
public ConfigureFubuMVC()
{
IncludeDiagnostics(true);
this.ApplyConvention<ModelValidationConfiguration>();
this.ApplyHandlerConventions<HandlersMarker>();
HtmlConvention(x => x.Editors.Always.Modify((request, tag) =>
{
var fubuRequest = request.Get<IFubuRequest>();
var validationResult = fubuRequest.Get<ValidationResult>();
if (validationResult.IsValid) return;
var ul = new HtmlTag("ul");
var liTags = validationResult.Errors.Where(error => error.PropertyName == request.Accessor.InnerProperty.Name).Select(vf => new HtmlTag("li", li => li.Text(vf.ErrorMessage)));
ul.Append(liTags);
tag.Append(ul);
}));
this.UseSpark();
Routes
.IgnoreNamespaceText("fubu101")
.HomeIs<GetHandler>(action => action.Execute(new MovieRequestModel()));
Policies.EnrichCallsWith<MovieViewModelJsonBehavior>(request => request.Returns<MovieViewModel>());
Views.TryToAttachWithDefaultConventions();
}
示例11: Build
public override HtmlTag Build(ElementRequest request)
{
HtmlTag root = new HtmlTag("div").Attr("data-bind", "foreach: "+ CCHtmlConventions2.DeriveElementName(request));
var child = new HtmlTag("div").Attr("data-bind", "text: $data" );
root.Append(child);
return root;
}
示例12: AdminForm
public static HtmlString AdminForm(DocumentNode Model, string adminUrl, string divClassName = "")
{
var div = new HtmlTag("div");
if (divClassName != "") div.AddClass(divClassName);
var form = new FormTag().Method("post").Action("#");
form.Append(HtmlBuilder.HtmlTagLabelInput("Name (header)", "name", Model.Name));
form.Append(new HtmlTag("input").Attr("type", "submit").Attr("name", "update").Attr("value", "Update"));
form.Append(HtmlBuilder.HtmlTagLabelCheckbox("Hide header", "hideHeader", Model.HideHeader));
form.Append(HtmlBuilder.HtmlTagLabelTextArea("Body text", "body", Model.Body));
form.Append(HtmlBuilder.HtmlTagLabelTextArea("Extra content 1", "extraContent1", Model.ExtraContent1, 5));
//form.Append(HtmlBuilder.HtmlTagLabelTextArea("Extra content 2", "extraContent2", Model.ExtraContent2, 5));
//form.Append(HtmlBuilder.HtmlTagLabelTextArea("Extra content 3", "extraContent3", Model.ExtraContent3, 3));
form.Append(HtmlBuilder.HtmlTagLabelInput("Author", "author", Model.Author));
form.Append(HtmlBuilder.HtmlTagLabelInput("ViewPath", "viewPath", Model.ViewPath));
form.Append(HtmlBuilder.HtmlTagLabelCheckbox("Hidden", "isHidden", Model.IsHidden));
form.Append(HtmlBuilder.HtmlTagLabelCheckbox("Deleted", "isDeleted", Model.IsDeleted));
form.Append(new HtmlTag("input").Attr("type", "submit").Attr("name", "update").Attr("value", "Update"));
if (!String.IsNullOrEmpty(Model.Url))
{
form.Append(new HtmlTag("p").Append(new HtmlTag("a").Attr("href", Model.Url).Text("View page")));
}
div.Append(form);
return new HtmlString(div.ToHtmlString());
}
示例13: get_tasks
public HtmlTag get_tasks()
{
var peers = _repository.FindPeers();
var cache = new Cache<Uri, TransportNode>();
peers.Each(peer => peer.OwnedTasks.Each(x => cache[x] = peer));
var tag = new HtmlTag("div");
tag.Add("h1").Text("Task Assignements");
var table = new TableTag();
tag.Append(table);
table.AddClass("table");
table.AddHeaderRow(row => {
row.Header("Task");
row.Header("Assigned to");
row.Header("Control Channel");
});
var tasks = _tasks.PermanentTasks().Union(_tasks.ActiveTasks()).ToArray();
tasks.Each(uri => {
table.AddBodyRow(row => addRow(row, uri, cache));
});
return tag;
}
示例14: Build
public override HtmlTag Build(ElementRequest request)
{
HtmlTag root = new HtmlTag("a");
root.Attr("href", "mailto:" + request.StringValue());
root.Attr("name", request.Accessor.FieldName + "Link");
root.Append(new HtmlTag("span").Text(request.StringValue()));
return root;
}
示例15: ToHtmlTag
public HtmlTag ToHtmlTag()
{
var root = new HtmlTag("form");
if (!string.IsNullOrEmpty(_id))
{
root.Attr("id", _id);
}
var innerDiv = new HtmlTag("div");
innerDiv.Append(new StyledButtonExpression("all", true).NonLocalizedText("All").ToHtmlTag());
for (int i = 65; i < 91; i++)
{
string letter = ((char)i).ToString();
innerDiv.Append(new StyledButtonExpression(letter, true).NonLocalizedText(letter).ToHtmlTag());
}
root.Append(innerDiv);
return root;
}