init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue