本文整理汇总了C#中Microsoft.AspNet.Razor.TagHelpers.TagHelperContext.SetFormGroupContext方法的典型用法代码示例。如果您正苦于以下问题:C# TagHelperContext.SetFormGroupContext方法的具体用法?C# TagHelperContext.SetFormGroupContext怎么用?C# TagHelperContext.SetFormGroupContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.AspNet.Razor.TagHelpers.TagHelperContext
的用法示例。
在下文中一共展示了TagHelperContext.SetFormGroupContext方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
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
});
}
示例3: Init
public override void Init(TagHelperContext context) {
base.Init(context);
FormContext = context.HasFormContext() ? context.GetFormContext() : new FormTagHelper();
context.SetFormContext(new FormTagHelper {
ControlSize = ControlSize ?? FormContext.ControlSize,
Output = FormContext.Output,
Inline = FormContext.Inline,
Horizontal = FormContext.Horizontal,
LabelWidthXs = FormContext.LabelWidthXs,
LabelWidthLg = LabelWidthLg ?? FormContext.LabelWidthLg,
LabelWidthMd = LabelWidthMd ?? FormContext.LabelWidthMd,
LabelWidthSm = LabelWidthSm ?? FormContext.LabelWidthSm,
LabelsSrOnly = FormContext.LabelsSrOnly
});
context.SetFormGroupContext(this);
Size = Size ?? FormContext.FormGroupSize;
}