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


C# ElementRequest.StringValue方法代码示例

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


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

示例1: Build

 public override HtmlTag Build(ElementRequest request)
 {
     var textAreaAttribute = request.Accessor.GetAttribute<TextAreaAttribute>();
     var value = request.StringValue().IsNotEmpty() ? request.StringValue() : "";
     return new HtmlTag("textarea")
         .Attr("rows",textAreaAttribute.Rows)
         .Attr("cols",textAreaAttribute.Columns)
         .Attr("name", request.ElementId)
         .Text(value);
 }
开发者ID:reharik,项目名称:KnowYourTurf,代码行数:10,代码来源:TextAreaBuilder.cs

示例2: Build

        public override HtmlTag Build(ElementRequest request)
        {
            var tag = new HtmlTag("div").Text(request.StringValue()).AddClass("editable").Id(request.Accessor.Name);

            var options = new EditOptions();

            if (request.Accessor.HasAttribute<MarkdownAttribute>())
            {
                tag.UnEncoded().Text(new Markdown().Transform(request.RawValue== null ? "" : request.RawValue.ToString()));
                options.Markdown = true;
            }

            options.MultiLine = request.Accessor.Name == "Details";
            options.RequiresExplicitUserActionForSave = true;

            options.MaximumLength = request.Accessor.PropertyType.Equals(typeof(string)) ? Entity.UnboundedStringLength : 0;
            options.IsDate = request.Accessor.PropertyType.IsDateTime();
            options.IsTime = request.Accessor.Name.ToLower().Contains("time");
            options.IsNumber = request.Accessor.PropertyType.IsIntegerBased() || request.Accessor.PropertyType.IsFloatingPoint();
            options.Required = request.Accessor.HasAttribute<RequiredAttribute>();
            options.PlaceholderText = "Double-Click to edit " + request.Accessor.Name.ToLower() + ".";

            var data = options.ToJson();

            tag.Attr("data", "{editoptions:"+data+"}");
            return tag;
        }
开发者ID:rauhryan,项目名称:kokugen,代码行数:27,代码来源:EditInPlaceBuilder.cs

示例3: Build

        public static HtmlTag Build(ElementRequest request)
        {
            var numberOfRows = 6;
            int? numberOfColumns = null;
            var attribute = request.Accessor.GetAttribute<MultilineAttribute>();
            if (attribute != null)
            {
                if (attribute.NumberOfRows.HasValue)
                {
                    numberOfRows = attribute.NumberOfRows.Value;
                }
                if (attribute.NumberOfColumns.HasValue)
                {
                    numberOfColumns = attribute.NumberOfColumns.Value;
                }
            }
            var textArea = new TextAreaTag()
                .Rows(numberOfRows);

            if (numberOfColumns.HasValue)
            {
                textArea.Cols(numberOfColumns.Value);
            }

            return textArea
                .Id(request.ElementId)
                .Attr(HtmlAttributeConstants.Name, request.ElementId)
                .Text(request.StringValue());
        }
开发者ID:phoenixwebgroup,项目名称:DotNetExtensions,代码行数:29,代码来源:TextAreaBuilder.cs

示例4: Build

 public override HtmlTag Build(ElementRequest request)
 {
     HtmlTag root = new HtmlTag("a");
     root.Attr("href", "#");
     root.Id(request.Accessor.FieldName);
     root.Append(new HtmlTag("span").Text(request.StringValue()));
     return root;
 }
开发者ID:reharik,项目名称:MethodFitness,代码行数:8,代码来源:LinkDisplayBuilder.cs

示例5: Build

		public static HtmlTag Build(ElementRequest req)
		{
			return new TextAreaTag()
				.Rows(6)
				.Id(req.ElementId)
				.Attr("name", req.ElementId)
				.Text(req.StringValue());
		}
开发者ID:ryanohs,项目名称:Fubu-HtmlTags-For-ASP.NET-MVC,代码行数:8,代码来源:TextAreaBuilder.cs

示例6: Build

        public override HtmlTag Build(ElementRequest request)
        {
            var enumType = request.Accessor.PropertyType;
            var enumValues = Enum.GetValues(enumType);

            var selectedValue = enumValues.Cast<object>()
                .First(e => e.ToString() == request.StringValue());

            var span = new HtmlTag("span")
                .Encoded(false)
                .Text(selectedValue.ToDescriptionString());

            return span;
        }
开发者ID:kirolosgerges,项目名称:Blog,代码行数:14,代码来源:EnumRadioButtonListDisplay.cs

示例7: ListItemFor

        private static HtmlTag ListItemFor(object enumValue, ElementRequest request)
        {
            var radioId = string.Format("{0}_{1}", request.ElementId, enumValue);

            var radioButton = new HtmlTag("input")
                .Attr("id", radioId)
                .Attr("name", request.ElementId)
                .Attr("type", "radio")
                .Attr("value", enumValue.ToString());
            if (enumValue.ToString() == request.StringValue())
            {
                radioButton.Attr("checked", "checked");
            }

            var label = new HtmlTag("label")
                .Attr("for", radioId)
                .Encoded(false)
                .Text(enumValue.ToDescriptionString());

            return new HtmlTag("li", tag => tag.Children.AddMany(new[] {radioButton, label}));
        }
开发者ID:kirolosgerges,项目名称:Blog,代码行数:21,代码来源:EnumRadioButtonListEditor.cs

示例8: Build

 public HtmlTag Build(ElementRequest request)
 {
     return new HtmlTag("span").Text(request.StringValue()).Id(request.ElementId);
 }
开发者ID:jv9,项目名称:htmltags,代码行数:4,代码来源:SpanDisplayBuilder.cs

示例9: BuildTextbox

 public static HtmlTag BuildTextbox(ElementRequest request)
 {
     return new TextboxTag().Attr("value", request.StringValue());
 }
开发者ID:joshuaflanagan,项目名称:fubumvc,代码行数:4,代码来源:TagActionExpression.cs

示例10: Build

 public override HtmlTag Build(ElementRequest request)
 {
     return new HtmlTag("span").Text(request.StringValue()).AddClass("fake");
 }
开发者ID:kharlamov,项目名称:FubuMVC.Core.UI,代码行数:4,代码来源:HtmlConventionRegistryTester.cs

示例11: Build

 public override HtmlTag Build(ElementRequest request)
 {
     var date = request.StringValue().IsNotEmpty() ? DateTime.Parse(request.StringValue()).ToShortTimeString() : "";
     return new TextboxTag().Attr("value", date).AddClass("timePicker");
 }
开发者ID:reharik,项目名称:KnowYourTurf,代码行数:5,代码来源:DatePickerBuilder.cs

示例12: BuildTextbox2

 public static HtmlTag BuildTextbox2(ElementRequest request)
 {
     var date = DateTime.Parse(request.StringValue()).ToShortDateString();
     return new TextboxTag().Attr("value", date).AddClass("mf_datePicker");
 }
开发者ID:reharik,项目名称:MethodFitness,代码行数:5,代码来源:CustomTagActionExpressions.cs

示例13: GetValue

 protected virtual string GetValue(ElementRequest request)
 {
     return request.ValueIsEmpty() ? string.Empty : request.StringValue();
 }
开发者ID:phoenixwebgroup,项目名称:DotNetExtensions,代码行数:4,代码来源:DefaultDisplay.cs


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