本文整理汇总了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);
}
示例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;
}
示例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());
}
示例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;
}
示例5: Build
public static HtmlTag Build(ElementRequest req)
{
return new TextAreaTag()
.Rows(6)
.Id(req.ElementId)
.Attr("name", req.ElementId)
.Text(req.StringValue());
}
示例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;
}
示例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}));
}
示例8: Build
public HtmlTag Build(ElementRequest request)
{
return new HtmlTag("span").Text(request.StringValue()).Id(request.ElementId);
}
示例9: BuildTextbox
public static HtmlTag BuildTextbox(ElementRequest request)
{
return new TextboxTag().Attr("value", request.StringValue());
}
示例10: Build
public override HtmlTag Build(ElementRequest request)
{
return new HtmlTag("span").Text(request.StringValue()).AddClass("fake");
}
示例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");
}
示例12: BuildTextbox2
public static HtmlTag BuildTextbox2(ElementRequest request)
{
var date = DateTime.Parse(request.StringValue()).ToShortDateString();
return new TextboxTag().Attr("value", date).AddClass("mf_datePicker");
}
示例13: GetValue
protected virtual string GetValue(ElementRequest request)
{
return request.ValueIsEmpty() ? string.Empty : request.StringValue();
}