当前位置: 首页>>代码示例>>C#>>正文


C# TagHelperContext.GetFormGroupContext方法代码示例

本文整理汇总了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;
            }
        }
开发者ID:Pietervdw,项目名称:BootstrapTagHelpers,代码行数:25,代码来源:InputGroupTagHelper.cs

示例2: Init

 public override void Init(TagHelperContext context)
 {
     base.Init(context);
     FormGroupContext = context.GetFormGroupContext();
     FormContext = context.GetFormContext();
     Size = Size ?? FormContext?.ControlSize;
 }
开发者ID:Pietervdw,项目名称:BootstrapTagHelpers,代码行数:7,代码来源:SelectTagHelper.cs

示例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
         });
 }
开发者ID:Pietervdw,项目名称:BootstrapTagHelpers,代码行数:30,代码来源:HorizontalFormContainerTagHelper.cs

示例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;
 }
开发者ID:Pietervdw,项目名称:BootstrapTagHelpers,代码行数:9,代码来源:LabelTagHelper.cs

示例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);
 }
开发者ID:Pietervdw,项目名称:BootstrapTagHelpers,代码行数:10,代码来源:InputTagHelper.cs

示例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));
 }
开发者ID:Pietervdw,项目名称:BootstrapTagHelpers,代码行数:21,代码来源:InputGroupTagHelper.cs

示例7: Init

 public override void Init(TagHelperContext context) {
     base.Init(context);
     FormGroupContext = context.GetFormGroupContext();
     FormContext = context.GetFormContext();
 }
开发者ID:Pietervdw,项目名称:BootstrapTagHelpers,代码行数:5,代码来源:FormControlStaticTagHelper.cs


注:本文中的Microsoft.AspNet.Razor.TagHelpers.TagHelperContext.GetFormGroupContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。