init
This commit is contained in:
27
KretaWeb/Helpers/Unhacked/RadioButtonExtensions.cs
Normal file
27
KretaWeb/Helpers/Unhacked/RadioButtonExtensions.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Web.Mvc;
|
||||
using Kendo.Mvc.UI;
|
||||
using Kendo.Mvc.UI.Fluent;
|
||||
|
||||
namespace Kreta.Web.Helpers.Unhacked
|
||||
{
|
||||
public static class RadioButtonExtensions
|
||||
{
|
||||
public static List<RadioButtonBuilder> KendoRadioButtonsFor<TModel, TProperty, T>(this HtmlHelper<TModel> html,
|
||||
Expression<Func<TModel, TProperty>> expression, List<T> options, Expression<Func<T, object>> idExpression, Expression<Func<T, string>> labelExpression)
|
||||
{
|
||||
var idMethod = idExpression.Compile();
|
||||
var labelMethod = labelExpression.Compile();
|
||||
var radioButtonBuilders = new List<RadioButtonBuilder>();
|
||||
|
||||
foreach (var option in options)
|
||||
{
|
||||
radioButtonBuilders.Add(html.Kendo().RadioButtonFor(expression).Label(labelMethod(option)).Value(idMethod(option)));
|
||||
}
|
||||
|
||||
return radioButtonBuilders;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user