Awesome ASP.net Core and MVC Controls

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)
@Html.AntiForgeryToken()
<input type="submit" value="submit" class="awe-btn" />
}
ViewModels/Input/AttributesDemoInput.cs
public class AttributesDemoInput
{
[Required]
[AweMeta("min", 30)]
[AweMeta("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")]
[AweParent("ParentCategory", "categories")]
[AweParam("categories", 157)]
public int? Meal1 { get; set; }

[Required]
[UIHint("Odropdown")]
[DisplayName("Child meal 2")]
[AweUrl(Action = "GetMeals", Controller = "Data")]
[AweParent("ParentCategory", "categories")]
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)]
public int? MealCustomSearch { get; set; }

[Required]
[UIHint("MultiLookup")]
[DisplayName("Meals multi")]
[MultiLookup(ClearButton = true, Controller = "MealsMultiLookup", Title = "select some stuff")]
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")]
[AweMeta("Placeholder", "try Ma...")]
public string MealAuto { get; set; }

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



Comments