本文整理汇总了C#中Microsoft.AspNet.Razor.TagHelpers.TagHelperContext.GetFormGroupContext方法的典型用法代码示例。如果您正苦于以下问题:C# TagHelperContext.GetFormGroupContext方法的具体用法?C# TagHelperContext.GetFormGroupContext怎么用?C# TagHelperContext.GetFormGroupContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.AspNet.Razor.TagHelpers.TagHelperContext
的用法示例。
在下文中一共展示了TagHelperContext.GetFormGroupContext方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public override void Init(TagHelperContext context) {
base.Init(context);
FormGroupContext = context.GetFormGroupContext();
FormContext = context.GetFormContext();
if (FormGroupContext != null) {
var formGroupContextClone = FormGroupContext.Clone();
context.SetFormGroupContext(formGroupContextClone);
formGroupContextClone.ControlSize=BootstrapTagHelpers.Size.Default;
if (FormGroupContext.FormContext != null) {
formGroupContextClone.FormContext.ControlSize=BootstrapTagHelpers.Size.Default;
context.SetFormContext(formGroupContextClone.FormContext);
}
}
else if (FormContext != null) {
FormTagHelper formTagHelperClone = FormContext.Clone();
context.SetFormContext(formTagHelperClone);
formTagHelperClone.ControlSize=BootstrapTagHelpers.Size.Default;
}
if (Size == null) {
var size = FormGroupContext?.ControlSize ?? FormContext?.ControlSize;
if (size != null)
Size = size == BootstrapTagHelpers.Size.Large ? SimpleSize.Large : SimpleSize.Small;
}
}
示例2: Init
public override void Init(TagHelperContext context)
{
base.Init(context);
FormGroupContext = context.GetFormGroupContext();
FormContext = context.GetFormContext();
Size = Size ?? FormContext?.ControlSize;
}
示例3: Init
public override void Init(TagHelperContext context) {
base.Init(context);
FormContext = context.GetFormContext();
FormGroupContext = context.GetFormGroupContext();
if (FormContext != null)
context.SetFormContext(new FormTagHelper {
LabelWidthLg = FormContext.LabelWidthLg,
LabelWidthMd = FormContext.LabelWidthMd,
LabelWidthSm = FormContext.LabelWidthSm,
LabelWidthXs = FormContext.LabelWidthXs,
FormGroupSize = FormContext.FormGroupSize,
Horizontal = false,
Inline = FormContext.Inline,
ControlSize = FormContext.ControlSize,
LabelsSrOnly = FormContext.LabelsSrOnly
});
if (FormGroupContext != null)
context.SetFormGroupContext(new FormGroupTagHelper {
FormContext = context.GetFormContext(),
Size = FormGroupContext.Size,
ControlSize = FormGroupContext.ControlSize,
HasFeedback = FormGroupContext.HasFeedback,
HasLabel = FormGroupContext.HasLabel,
LabelWidthLg = FormGroupContext.LabelWidthLg,
LabelWidthMd = FormGroupContext.LabelWidthMd,
LabelWidthXs = FormGroupContext.LabelWidthXs,
LabelWidthSm = FormGroupContext.LabelWidthSm,
ValidationContext = FormGroupContext.ValidationContext
});
}
示例4: Init
public override void Init(TagHelperContext context) {
base.Init(context);
FormContext = context.GetFormContext();
FormGroupContext = context.GetFormGroupContext();
if (FormGroupContext != null)
FormGroupContext.HasLabel = true;
context.SetLabelContext(this);
SrOnly = SrOnly ?? FormContext?.LabelsSrOnly;
}
示例5: Init
public override void Init(TagHelperContext context) {
base.Init(context);
FormContext = context.GetFormContext();
FormGroupContext = context.GetFormGroupContext();
InputGroupContext = context.GetInputGroupContext();
IsInLabel = context.HasLabelContext();
Size = Size ?? FormContext?.ControlSize;
if (FormGroupContext != null)
FormGroupContext.HasLabel = FormGroupContext.HasLabel || !string.IsNullOrEmpty(Label);
}
示例6: BootstrapProcessAsync
protected override async Task BootstrapProcessAsync(TagHelperContext context, TagHelperOutput output) {
output.TagName = "div";
output.AddCssClass("input-group");
if ((Size??SimpleSize.Default) != SimpleSize.Default)
output.AddCssClass("input-group-" + Size.Value.GetDescription());
if (!string.IsNullOrEmpty(PreAddonText))
output.PreContent.SetHtmlContent(AddonTagHelper.GenerateAddon(PreAddonText));
if (!string.IsNullOrEmpty(PostAddonText))
output.PostContent.SetHtmlContent(AddonTagHelper.GenerateAddon(PostAddonText));
context.SetInputGroupContext(this);
await output.GetChildContentAsync();
var preElementContent = output.PreElement.GetContent();
output.PreElement.Clear();
if (FormGroupContext != null)
FormGroupContext.WrapInDivForHorizontalForm(output, context.GetFormGroupContext()?.HasLabel??false);
else if (FormContext != null)
FormContext.WrapInDivForHorizontalForm(output, context.GetFormGroupContext()?.HasLabel ?? false);
output.PreElement.PrependHtml(preElementContent);
if (!string.IsNullOrEmpty(HelpContent))
output.PostElement.PrependHtml(HelpBlockTagHelper.GenerateHelpBlock(HelpContent));
}
示例7: Init
public override void Init(TagHelperContext context) {
base.Init(context);
FormGroupContext = context.GetFormGroupContext();
FormContext = context.GetFormContext();
}