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


C# ElementRequest.Value方法代码示例

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


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

示例1: BuildTag

        protected override HtmlTag BuildTag(ElementRequest request)
        {
            var attribute = GetCheckBoxListAttribute(request);
            var tag = attribute.Horizontal ? Tags.Span : Tags.Div;

            var optionPairs = GetOptionPairs(request, attribute);
            var checkedOptions = request.Value<IList<int>>().Cast<object>();
            var groupName = request.ElementId;
            foreach (var option in optionPairs)
            {
                var isChecked = checkedOptions.Contains(option.Value);
                var label = Tags.Label.For(groupName).Text(option.Text);
                var checkBox = Tags.Checkbox(isChecked).Name(groupName).Value(option.Value);

                tag.Nest(
                    Tags.Div.Nest(
                        Tags.Span
                            .AddClass(OptionSpanClass)
                            .AddClass(attribute.Horizontal ? OptionHorizontalSpanClass : string.Empty)
                            .Nest(
                                label,
                                checkBox
                            )));
            }

            return tag
                .AddClass(CheckBoxesClass);
        }
开发者ID:phoenixwebgroup,项目名称:DotNetExtensions,代码行数:28,代码来源:CheckBoxListBuilder.cs

示例2: BuildTag

		protected override HtmlTag BuildTag(ElementRequest req)
		{
			var attrib = GetCheckBoxListAttribute(req);
			var optionPairs = GetOptionPairs(req, attrib);
			var checkedOptions = req.Value<IList<int>>().Cast<object>();
			var groupName = req.ElementId;

			var div = attrib.Horizontal ? Tags.Span : Tags.Div;
			foreach (var item in optionPairs)
			{
				var isChecked = checkedOptions.Contains(item.Value);
				var label = Tags.Label.For(groupName).Text(item.Text);
				var checkBox = Tags.Checkbox(isChecked).Name(groupName).Value(item.Value);

				div.Nest(
					Tags.Div.Nest(
						Tags.Span
							.AddClass("option")
							.AddClass(attrib.Horizontal ? "horizontalOption" : "")
							.Nest(
								label,
								checkBox
							)));
			}
			return div.AddClass("checkboxes");
		}
开发者ID:ryanohs,项目名称:Fubu-HtmlTags-For-ASP.NET-MVC,代码行数:26,代码来源:CheckBoxListBuilder.cs

示例3: SetSelectedValue

 private static void SetSelectedValue(ElementRequest request, SelectTag select)
 {
     if (!request.ValueIsEmpty())
     {
         select.SelectByValue(request.Value<int>().ToString());
     }
 }
开发者ID:phoenixwebgroup,项目名称:DotNetExtensions,代码行数:7,代码来源:EnumDropDownBuilder.cs

示例4: Build

        public override HtmlTag Build(ElementRequest request)
        {
            var name = request.Accessor.Name;
            var pair = request.Value<AutoCompleteInput>();

            var textBoxId = name + "Text";
            var textBox = Tags.Input
                .Attr(HtmlAttributeConstants.Type, "Text")
                .Id(textBoxId)
                .Value(pair.Text)
                .Attr(HtmlAttributeConstants.Name, textBoxId);

            var valueBoxId = name + "Value";
            var valueBox = Tags.Hidden
                .Id(valueBoxId)
                .Value(pair.Value)
                .Attr(HtmlAttributeConstants.Name, valueBoxId);

            var createScript = GetCreateScript(textBoxId, pair.Url);

            var resultScript = GetResultScript(textBoxId, valueBoxId);

            return Tags.Span.Nest(
                textBox,
                valueBox,
                createScript,
                resultScript
                );
        }
开发者ID:phoenixwebgroup,项目名称:DotNetExtensions,代码行数:29,代码来源:AutoCompleteBuilder.cs

示例5: Build

        public override HtmlTag Build(ElementRequest request)
        {
            var attr = request.Accessor.GetAttribute<ValueOfAttribute>();

            var value = ValueObjectRegistry.GetValueObjectHolder(attr.Name);

            if (value == null) return new TextboxTag(request.ElementId, request.Value<string>());

            var defaultValue = "";
            if (request.RawValue != null)
            {
                defaultValue = request.RawValue.ToString();
            }
            if (defaultValue.IsEmpty())
            {
                ValueObject @default = value.Values.FirstOrDefault(x => x.IsDefault);
                if (@default != null) defaultValue = @default.Key;
            }

            return new SelectTag(tag =>
                                     {
                                         tag.TopOption(string.Format("-- Select {0} --", value.GetKey()), null);
                                         value.Values.Each(vo => tag.Option(vo.Value, vo.Key));
                                         tag.SelectByValue(defaultValue);
                                     });
        }
开发者ID:rauhryan,项目名称:kokugen,代码行数:26,代码来源:ValueObjectDropdownBuilder.cs

示例6: BuildTag

        protected override HtmlTag BuildTag(ElementRequest request)
        {
            var isChecked = request.Value<bool>();

            return Tags.Checkbox(isChecked)
                .Value(CheckBoxValueWhenChecked)
                .Id(request.ElementId);
        }
开发者ID:phoenixwebgroup,项目名称:DotNetExtensions,代码行数:8,代码来源:CheckBoxBuilder.cs

示例7: CheckBoxBuilder

 public static HtmlTag CheckBoxBuilder(ElementRequest request)
 {
     var isChecked = request.Value<bool>();
     var tag = new CheckboxTag(isChecked);
     tag.Attr("name", request.Accessor.Name);
     tag.AddClass("checkbox");
     return tag;
 }
开发者ID:eatsleeptraincode,项目名称:crossfit204scoreboard,代码行数:8,代码来源:HtmlBuilders.cs

示例8: GetValue

 private MonthOfYear GetValue(ElementRequest request)
 {
     var value = MonthOfYear.Current;
     if (!request.ValueIsEmpty())
     {
         value = request.Value<MonthOfYear>();
     }
     return value;
 }
开发者ID:phoenixwebgroup,项目名称:DotNetExtensions,代码行数:9,代码来源:MonthOfYearBuilder.cs

示例9: GetNamesOfFlagsThatAreSet

        private IEnumerable<string> GetNamesOfFlagsThatAreSet(ElementRequest request)
        {
            var value = request.Value<int>();
            var flagsEnumType = RemoveNullableIfNecessary(request.Accessor.PropertyType);

            return EnumHelper
                .GetOptions(flagsEnumType)
                .Where(o => ValueHasOptionSet(value, o))
                .Select(o => o.Name);
        }
开发者ID:phoenixwebgroup,项目名称:DotNetExtensions,代码行数:10,代码来源:FlagsEnumDisplayBuilder.cs

示例10: BuildTag

		protected override HtmlTag BuildTag(ElementRequest request)
		{
			var tag = Tags.Span;
			if (request.ValueIsEmpty())
			{
				return tag;
			}

			var value = request.Value<DateTime>();
			tag.Text(value.ToShortDateString());
			return tag;
		}
开发者ID:ryanohs,项目名称:Fubu-HtmlTags-For-ASP.NET-MVC,代码行数:12,代码来源:DateOnlyBuilder.cs

示例11: BuildDisplay

 public static HtmlTag BuildDisplay(ElementRequest request)
 {
     var time = request.Value<Time>();
     var baseName = request.Accessor.Name;
     var tag = new HtmlTag("span", c =>
                                       {
                                           c.Append(BuildTimeElementDisplayTag(baseName + Minutes, time.Minutes, "##"));
                                           c.Append(new LiteralTag(":"));
                                           c.Append(BuildTimeElementDisplayTag(baseName + Seconds, time.Seconds, "0#.#"));
                                       });
     return tag;
 }
开发者ID:eatsleeptraincode,项目名称:crossfit204scoreboard,代码行数:12,代码来源:TimeBuilder.cs

示例12: BuildTag

        protected override HtmlTag BuildTag(ElementRequest request)
        {
            var tag = new CalendarTextBox(request.ElementId);

            if (request.ValueIsEmpty())
            {
                return tag;
            }

            var value = request.Value<DateTime>();
            return tag.SetDate(value);
        }
开发者ID:phoenixwebgroup,项目名称:DotNetExtensions,代码行数:12,代码来源:DatePickerBuilder.cs

示例13: buildOptions

        private static void buildOptions(ElementRequest request, SelectTag tag)
        {
            var listElements = GetListElementTitlesOrderedByRank(request);

            listElements.ElementTitles.Each(title => tag.Option(title, title));

            var requestValue = request.Value<string>();

            var defaultValue = requestValue.IsNotEmpty() ? requestValue : listElements.DefaultElementTitle;

            tag.SelectByValue(defaultValue);
        }
开发者ID:KevM,项目名称:dovetail-bootstrap,代码行数:12,代码来源:GbstListValueDropdownBuilder.cs

示例14: BuildTag

		protected override HtmlTag BuildTag(ElementRequest request)
		{
			var tag = Tags.Span;
			if (request.ValueIsEmpty())
			{
				return tag;
			}

			var value = request.Value<int>();
			var type = RemoveNullableIfNecessary(request.Accessor.PropertyType);
			var options = EnumHelper.GetOptions(type);
			var values = options.Where(o => (value & (int) o.GetValue(null)) > 0).Select(o => o.Name).ToArray();
			tag.Text(String.Join(", ", values));
			return tag;
		}
开发者ID:ryanohs,项目名称:Fubu-HtmlTags-For-ASP.NET-MVC,代码行数:15,代码来源:FlagsEnumDisplayBuilder.cs

示例15: BuildOptions

		private Action<SelectTag> BuildOptions(ElementRequest req)
		{
			var hasBlankOption = req.Accessor.HasAttribute<WithBlankOption>();
			return tag =>
			       	{
			       		var options = GetOptions(req);
			       		if (hasBlankOption)
			       		{
			       			tag.Option("", "");
			       		}
			       		foreach (var f in options)
			       		{
			       			tag.Option(GetText(f, req), f.GetRawConstantValue().ToString());
			       		}
			       		if (!req.ValueIsEmpty())
			       		{
			       			tag.SelectByValue(req.Value<int>().ToString());
			       		}
			       	};
		}
开发者ID:ryanohs,项目名称:Fubu-HtmlTags-For-ASP.NET-MVC,代码行数:20,代码来源:EnumDropDownBuilder.cs


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