本文整理汇总了C#中HtmlTags.HtmlTag.Child方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlTag.Child方法的具体用法?C# HtmlTag.Child怎么用?C# HtmlTag.Child使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HtmlTags.HtmlTag
的用法示例。
在下文中一共展示了HtmlTag.Child方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Build
public override HtmlTag Build(ElementRequest request)
{
HtmlTag root = new HtmlTag("div");
root.AddClass("KYT_ListDisplayRoot");
var selectListItems = request.RawValue as IEnumerable<string>;
if (selectListItems == null) return root;
selectListItems.Each(item=> root.Child(new HtmlTag("div").Text(item)));
return root;
}
示例2: DebugReportTagWriter
public DebugReportTagWriter()
{
_lastTag = _div;
_behaviorTags.OnMissing = b =>
{
HtmlTag tag = BuildBehaviorTag(b);
_lastTag.Child(tag);
_lastTag = tag;
return tag;
};
}
示例3: WriteBody
public void WriteBody(BehaviorChain chain, HtmlTag row, HtmlTag cell)
{
var text = Text(chain);
if (shouldBeClickable(chain.Route))
{
cell.Child(new LinkTag(text, chain.Route.Pattern.ToAbsoluteUrl()).AddClass("route-link"));
}
else
{
cell.Text(text);
}
if (text.StartsWith(DiagnosticUrlPolicy.DIAGNOSTICS_URL_ROOT))
{
row.AddClass(BehaviorGraphWriter.FUBU_INTERNAL_CLASS);
}
}
示例4: FilterTemplatesFor
public HtmlTag FilterTemplatesFor(GridViewModel model)
{
var tag = new HtmlTag("div");
var containerNameForGrid = model.GridType.ContainerNameForGrid();
tag.Id("filters_" + containerNameForGrid);
tag.AddClass("smart-grid-filter");
tag.Child(new TableTag());
var metadata = new Dictionary<string, object>{
{"gridId", "grid_" + model.GridName},
{"initialCriteria", model.InitialCriteria()}
};
tag.MetaData("filters", metadata);
var properties = model.FilteredProperties;
var templates = _sources.SelectMany(x => x.TagsFor(properties));
var operators = properties.Select(prop =>
{
return new SelectTag(select =>
{
prop.Operators.Each(oper => select.Option(oper.ToString(), oper.Key));
}).AddClass(prop.Accessor.Name);
});
tag.Add("div", div =>
{
div.Hide();
div.AddClass("templates");
div.Add("div").AddClass("smart-grid-editors").AddChildren(templates);
div.Add("div").AddClass("smart-grid-operators").AddChildren(operators);
div.Child(new SelectTag(select =>
{
select.AddClass("smart-grid-properties");
properties.Each(prop => select.Option(prop.Header, prop.Accessor.Name));
}));
});
return tag;
}
示例5: Execute
public HtmlTag Execute(ManageProjectMenuRequest request)
{
var menus = new HtmlTag("ul");
//menus.Child(new HtmlTag("li").Child(
// new LinkTag("Add User",
// _urlRegistry.UrlFor(new AddUserToProjectRequest() {Id = request.Id}),
// "manage-proj-menu").Title("Add User")).AddClass("bar"));
menus.Child(new HtmlTag("li").Child(
new LinkTag("Manage Users",
_urlRegistry.UrlFor(new ProjectUsersRequest() { Id = request.Id }),
"").Title("Manage Users")).AddClass("bar"));
var script = new HtmlTag("script").Attr("type", "text/javascript")
.Text(
"$(function(){$('.manage-proj-menu').ajaxDialog({onComplete:HandleAjaxResponse,dataType:'json'});});");
menus.Next = script;
return menus;
}
示例6: WriteBody
public void WriteBody(BehaviorChain chain, HtmlTag row, HtmlTag cell)
{
cell.Child(new LinkTag(Text(chain), "chain/" + chain.UniqueId).AddClass("chainId"));
}
示例7: Example
public HtmlDocument Example(ExampleHtmlRequest exampleHtmlRequest)
{
var modelPath = exampleHtmlRequest.Model ?? typeof(ExampleViewModel).FullName + "-Person";
var tags = new List<HtmlTag>();
var propertyPath = new List<string>(modelPath.Split('-'));
var rootModelTypeName = propertyPath[0];
tags.Add(new HtmlTag("h3").AddClass("viewmodel").Text(propertyPath.Join(".")));
propertyPath.RemoveAt(0);
Type scannedModelType = getTypeFromName(rootModelTypeName);
var scannedModelInstance = createInstance(scannedModelType);
var tagGeneratorType = typeof(TagGenerator<>).MakeGenericType(scannedModelType);
var tagGenerator = (ITagGenerator)_serviceLocator.GetInstance(tagGeneratorType);
tagGenerator.SetModel(scannedModelInstance);
var propertyChainParts = new List<PropertyInfo>();
while (propertyPath.Count > 0)
{
var parentPropertyInfo = scannedModelType.GetProperty(propertyPath[0]);
propertyChainParts.Add(parentPropertyInfo);
var currentModelType = parentPropertyInfo.PropertyType;
var currentModel = createInstance(currentModelType);
setProperty(parentPropertyInfo, scannedModelInstance, currentModel);
scannedModelType = currentModelType;
scannedModelInstance = currentModel;
propertyPath.RemoveAt(0);
}
var modelProperties = scannedModelType.GetProperties();
var propertiesToLink = modelProperties.Where(p => !TypeDescriptor.GetConverter(p.PropertyType).CanConvertFrom(typeof(string)));
var propertiesToShow = modelProperties.Except(propertiesToLink);
// show links to deeper properties
var linkList = new HtmlTag("ul").AddClass("subproperties");
foreach (var propertyInfo in propertiesToLink)
{
var linkTag = new LinkTag("", _examplePageUrl + "?model=" + modelPath + "-" + propertyInfo.Name);
linkTag.Child(new HtmlTag("code").Text(getPropertySourceCode(propertyInfo)));
var listItem = new HtmlTag("li").Child(linkTag);
linkList.Child(listItem);
}
if (linkList.Children.Count > 0) tags.Add(linkList);
// show examples
populateInstance(scannedModelInstance, propertiesToShow);
foreach (var propertyInfo in propertiesToShow)
{
var property = propertyChainParts.Count > 0 ?
(Accessor) new PropertyChain(propertyChainParts.Concat(new[]{propertyInfo}).ToArray()) :
new SingleProperty(propertyInfo);
var propertyExpression = "x => x." + property.PropertyNames.Join(".");
var propertySource = getPropertySourceCode(propertyInfo);
var example = new HtmlTag("div").AddClass("example");
example.AddChildren(new HtmlTag("code").AddClass("property").Text(propertySource));
example.AddChildren(createExample(tagGenerator.LabelFor(tagGenerator.GetRequest(property)), "LabelFor({0})".ToFormat(propertyExpression)));
example.AddChildren(createExample(tagGenerator.DisplayFor(tagGenerator.GetRequest(property)), "DisplayFor({0})".ToFormat(propertyExpression)));
example.AddChildren(createExample(tagGenerator.InputFor(tagGenerator.GetRequest(property)), "InputFor({0})".ToFormat(propertyExpression)));
tags.Add(example);
}
var doc = DiagnosticHtml.BuildDocument(_urlRegistry, "FubuMVC.UI Examples", tags.ToArray());
doc.AddStyle(DiagnosticHtml.GetResourceText(GetType(), "examples.css"));
return doc;
}
示例8: WriteBody
public void WriteBody(BehaviorChain chain, HtmlTag row, HtmlTag cell)
{
var outputType = chain.ActionOutputType();
cell.Child(new LinkTag(outputType.Name, _examplePageUrl + "?model=" + outputType.FullName));
}
示例9: showIntro
private HtmlTag showIntro()
{
var container = new HtmlTag("div").AddClass("intro");
container.Child(
new HtmlTag("p").Text(@"
These pages demonstrate the output that is rendered when using the FubuMVC.UI conventional HTML generators (InputFor/DisplayFor/LabelFor).
To alter how the tags are generated, create your own class that derives from HtmlConventionRegistry, and declare it in your FubuRegistry using:"
));
container.Child(new HtmlTag("pre").Text("this.HtmlConvention<MyHtmlConventionRegistry>();"));
container.Child(
new HtmlTag("p").Text(@"
To alter how a property value is converted to a string value, use the StringConversions() extension method in your FubuRegistry. For example:"
));
container.Child(new HtmlTag("pre").Text(@"
this.StringConversions(x =>
{
x.IfIsType<DateTime>().ConvertBy(date => date.ToShortDateString());
});
"));
container.Child(new HtmlTag("p").Text(@"You can see the conventions applied by selecting one of your view models below, or applied to ").Child(new LinkTag("the built-in example model.", _examplePageUrl)));
return container;
}
示例10: getDiagnosticActionLink
private HtmlTag getDiagnosticActionLink(MethodInfo method, string url)
{
var li = new HtmlTag("li");
li.Child(new LinkTag(method.Name, url));
var description = method.GetAttribute<DescriptionAttribute>().Description;
li.Child(new HtmlTag("span").Text(" - " + description));
return li;
}
示例11: Index
public HtmlDocument Index()
{
var tags = new List<HtmlTag>();
var ul = new HtmlTag("ul");
tags.Add(ul);
availableActions().Each(method =>
{
var url = DiagnosticUrlPolicy.RootUrlFor(method);
ul.Child(getDiagnosticActionLink(method, url));
});
var diagnosticAssemblies = _graph.Behaviors
.Where(isDiagnosticChain)
.GroupBy(chain => chain.FirstCall().HandlerType.Assembly.GetName().Name)
.OrderBy(group => group.Key);
foreach (var assembly in diagnosticAssemblies)
{
tags.Add(new HtmlTag("h3").Text(assembly.Key));
var moreUl = new HtmlTag("ul");
tags.Add(moreUl);
foreach (var additionalRoute in assembly)
{
moreUl.Child(getDiagnosticActionLink(additionalRoute.FirstCall().Method, additionalRoute.RoutePattern.ToAbsoluteUrl()));
}
}
return BuildDocument("Home", tags.ToArray());
}
示例12: Chain
public HtmlDocument Chain(ChainRequest chainRequest)
{
var title = "Chain " + chainRequest.Id;
var behaviorChain = _graph.Behaviors.FirstOrDefault(chain => chain.UniqueId == chainRequest.Id);
if (behaviorChain == null)
{
return BuildDocument("Unknown chain", new HtmlTag("span").Text("No behavior chain registered with ID: " + chainRequest.Id));
}
var content = new HtmlTag("div").AddClass("main-content");
var document = new HtmlTag("div");
var pattern = behaviorChain.RoutePattern;
if( pattern == string.Empty )
{
pattern = "(default)";
}
document.Child(new HtmlTag("div").Text("Route: " + pattern));
var nodeTable = new TableTag();
nodeTable.AddHeaderRow(header =>
{
header.Header("Category");
header.Header("Description");
header.Header("Type");
});
foreach (var node in behaviorChain)
{
var description = node.ToString().HtmlEncode().ConvertCRLFToBreaks();
nodeTable.AddBodyRow(row =>
{
row.Cell().Text(node.Category.ToString());
row.Cell().UnEncoded().Text(description);
row.Cell().Text(node.GetType().FullName);
if (description.Contains(_diagnosticsNamespace))
{
row.AddClass(FUBU_INTERNAL_CLASS);
}
});
}
var logDiv = new HtmlTag("div").AddClass("convention-log");
var ul = logDiv.Add("ul");
var observer = _graph.Observer;
behaviorChain.Calls.Each(
call => observer.GetLog(call).Each(
entry => ul.Add("li").Text(entry)));
content.AddChildren(new[]{
document,
new HtmlTag("h3").Text("Nodes:"),
nodeTable,
new HtmlTag("h3").Text("Log:"),
logDiv});
return BuildDocument(title, content);
}
示例13: addCommentLink
private void addCommentLink(HtmlTag tag)
{
var commentLink = new SelectorLinkTag(GrammarConstants.COMMENT);
commentLink.Label(GrammarConstants.COMMENT);
tag.Child(commentLink);
}
示例14: Chain
public HtmlDocument Chain(ChainRequest chainRequest)
{
var behaviorChain = _graph.Behaviors.FirstOrDefault(chain => chain.UniqueId == chainRequest.Id);
if (behaviorChain == null)
{
return BuildDocument("Unknown chain", new HtmlTag("span").Text("No behavior chain registered with ID: " + chainRequest.Id));
}
var heading = new HtmlTag("h1").Modify(t =>
{
t.Add("span").Text("Chain ");
t.Add("span").AddClass("chainId").Text(behaviorChain.UniqueId.ToString());
});
var document = new HtmlTag("div");
document.Child(new HtmlTag("div").Text("Route: " + behaviorChain.RoutePattern));
var nodeTable = new TableTag();
nodeTable.AddHeaderRow(header =>
{
header.Header("Category");
header.Header("Description");
header.Header("Type");
});
behaviorChain.Each(node => nodeTable.AddBodyRow(row =>
{
row.Cell().Text(node.Category.ToString());
row.Cell().Text(node.ToString());
row.Cell().Text(node.GetType().FullName);
}));
return BuildDocument("Chain " + chainRequest.Id, heading, document, new HtmlTag("h2").Text("Nodes:"), nodeTable);
}