I have created view model class like bellow
public class GenericFormModel
{
public string SimpleInput { get; set; }
public string InputAddOn { get; set; }
public string InputTextArea { get; set; }
public DateRange Date { get; set; }
}
Then I created my own create template CustomCreate.cs.t4 under rote/CodeTemplates/MvcView location. I try to create Input Razor control for DateRange property . But I can't able to read DateRange Property from CustomCreate.cs.t4 like below
<#
foreach (PropertyMetadata property in ModelMetadata.Properties) {
if (property.Scaffold && !property.IsAutoGenerated && !property.IsReadOnly && !property.IsAssociation) {
if (property.IsPrimaryKey && IsPropertyGuid(property)) {
continue;
}
#>
@Html.InputFor(model => model.<#= property.PropertyName #>)
<#
}
}
#>
Note:
My problem is ModelMetadata.Properties only return string,int,DateTime,decimal ..properies only. It did not return DateRange Property.
What mistake did I make? I am using VS2013 And MVC5.
InputFor() is My custom Html Helper