/// <summary> /// Render a property editor. /// </summary> /// <param name="helper">A htmlhelper.</param> /// <param name="property">Property metadata.</param> /// <param name="value">Property value.</param> public static MvcHtmlString Editor(this HtmlHelper helper, IPropertyMetadata property, object value) { if (helper == null) throw new ArgumentNullException("helper"); if (property == null) throw new ArgumentNullException("property"); MvcEditorModel model = new MvcEditorModel(); model.Metadata = property; model.Value = value; if (property.Type == CustomDataType.Other) return helper.Partial(property.CustomType + "Editor", model); else return helper.Partial(property.Type.ToString() + "Editor", model); }
/// <summary> /// Render a property editor. /// </summary> /// <param name="helper">A htmlhelper.</param> /// <param name="property">Property metadata.</param> /// <param name="value">Property value.</param> public static void Editor(this HtmlHelper helper, PropertyMetadata property, object value) { if (helper == null) throw new ArgumentNullException("helper"); if (property == null) throw new ArgumentNullException("property"); MvcEditorModel model = new MvcEditorModel(); model.Metadata = property; model.Value = value; if (property.Type == CustomDataType.Other) System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(helper, property.CustomType + "Editor", model); else System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(helper, property.Type.ToString() + "Editor", model); }