using System.Collections.Generic; using System.Text; using System.Web.Mvc; using Kendo.Mvc.UI; using Kendo.Mvc.UI.Fluent; namespace Kreta.Web.Helpers { public static class RadioButtonExtensions { public static RadioButtonBuilder KretaRadioButton(this HtmlHelper helper, string name, string label, bool check, bool enabled = true, IDictionary htmlAttributes = null) { var rb = helper.Kendo().RadioButton() .Name(name) .Label(label) .Checked(check) .Enable(enabled); if (htmlAttributes != null) { rb.HtmlAttributes(htmlAttributes); } return rb; } public static MvcHtmlString RenderWithoutName(this RadioButtonBuilder helper, string customClass = "", string tooltipResource = null, string tooltipWidth = null, bool isInnerTooltip = true) { var sb = new StringBuilder(); sb.AppendFormat("
", BootsrapHelper.GetSizeClasses(12)); sb.AppendFormat("
", customClass); sb.Append(helper.ToHtmlString()); sb.Append("
"); if (!string.IsNullOrWhiteSpace(tooltipResource)) { if (isInnerTooltip) { sb.AppendFormat("
", customClass); sb.AppendFormat(""); sb.Append("
"); } else { sb.AppendLine($@"
{tooltipResource}
"); sb.Append($@""); } } sb.Append("
"); return new MvcHtmlString(sb.ToString()); } } }