Attributes demo

This view uses only EditorFor helpers, and parameters for the helpers are set using. AdditionalMetadata attribute can be used to set any property of the helper.
 
  •  

AttributesDemo/Index.cshtml
@using (Html.BeginForm())
{
@Html.EditorFor(o => o.Number)
@Html.EditorFor(o => o.ParentCategory)
@Html.EditorFor(o => o.Meal1)
@Html.EditorFor(o => o.Meal2)
@Html.EditorFor(o => o.MealCustomSearch)
@Html.EditorFor(o => o.SomeMeals)
@Html.EditorFor(o => o.SomeCategories)
@Html.EditorFor(o => o.MealAuto)
@Html.EditorFor(o => o.MealId)
@Html.EditorFor(o => o.Date)
<input type="submit" value="submit" class="awe-btn" />
}
ViewModels/Input/AttributesDemoInput.cs
public class AttributesDemoInput
{
[Required]
[AdditionalMetadata("min", 30)]
[AdditionalMetadata("max", 100)]
public int? Number { get; set; }

[Required]
[UIHint("Odropdown")]
[DisplayName("Parent category")]
[AweUrl(Action = "GetCategories", Controller = "Data")]
public int? ParentCategory { get; set; }

[Required]
[UIHint("AjaxDropdown")]
[DisplayName("Child meal")]
[AweUrl(Action = "GetMeals", Controller = "Data")]
[AwesomeParents("{ categories: 'ParentCategory' }")]
public int? Meal1 { get; set; }

[Required]
[UIHint("AjaxRadioList")]
[DisplayName("Child meal 2")]
[AweUrl(Action = "GetMeals", Controller = "Data")]
[AwesomeParents("{ categories: 'ParentCategory' }")]
public int? Meal2 { get; set; }

[Required]
[UIHint("Lookup")]
[DisplayName("Meal custom search")]
[Lookup(ClearButton = true, Title = "this is a lookup with custom search", CustomSearch = true, Fullscreen = true)]
public int? MealCustomSearch { get; set; }

[Required]
[UIHint("MultiLookup")]
[DisplayName("Meals multi")]
[MultiLookup(ClearButton = true, Controller = "MealsMultiLookup", DragAndDrop = true, Title = "select some stuff", Fullscreen = true)]
public IEnumerable<int> SomeMeals { get; set; }

[Required]
[UIHint("AjaxCheckboxList")]
[AweUrl(Action = "GetCategories", Controller = "Data")]
public IEnumerable<int> SomeCategories { get; set; }

[UIHint("Hidden")]
public int? MealId { get; set; }

[Required]
[UIHint("Autocomplete")]
[Autocomplete(Controller = "MealAutocomplete", Prefix = "eg", MinLength = 2, Delay = 500, PropId = "MealId")]
[AdditionalMetadata("Placeholder", "try Ma...")]
public string MealAuto { get; set; }

[AdditionalMetadata("Placeholder", "please pick date")]
[AdditionalMetadata("ClearButton", true)]
public DateTime? Date { get; set; }
}