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


C# TagHelperContext.GetFormContext方法代码示例

本文整理汇总了C#中Microsoft.AspNet.Razor.TagHelpers.TagHelperContext.GetFormContext方法的典型用法代码示例。如果您正苦于以下问题:C# TagHelperContext.GetFormContext方法的具体用法?C# TagHelperContext.GetFormContext怎么用?C# TagHelperContext.GetFormContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.AspNet.Razor.TagHelpers.TagHelperContext的用法示例。


在下文中一共展示了TagHelperContext.GetFormContext方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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

示例2: 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

示例3: 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

示例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: 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;
 }
开发者ID:Pietervdw,项目名称:BootstrapTagHelpers,代码行数:17,代码来源:FormGroupTagHelper.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.GetFormContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。