In MVC 4, How do i access a model expression inside a BookingPaymentMode.cshtml?
@Html.EditorFor(m => m.PaymentMode, "BookingPaymentMode")
And
@model MVCApplication.ViewModel.PaymentMode
@using System.Text
@{
var htmlHelper = this.Html;
var metaData = this.ViewData.ModelMetadata;
var expression=???
}
However I was doing this with HTML helper class
@Html.RadioButtonForEnum(m => m.Gender)
public static MvcHtmlString RadioButtonForEnum<TModel, TProperty>(
this HtmlHelper<TModel> htmlHelper,
Expression<Func<TModel, TProperty>> expression
)
{
var metaData = ModelMetadata.FromLambdaExpression(
expression, htmlHelper.ViewData)
}
This is how my UI looks.
Payment can be a type of Partly Paid, Fully Paid, UnPaid
Also it has a text box for Partly Paid amount.
I decided to use enum and CustomEditor. Is there a simple way of doing this?