Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
70
DatepickerOptions in MVC View
posted

I am trying to add the code to make a datepicker into just a month and/or year picker in a MVC View, not via javascript. I have code that looks like this:

@(Html.Infragistics().DatePicker()
.ID(EndMonthId)
.Width("100px")
.Height(24)
.Value(month != null ? month : DateTime.Now.Month)
.DateDisplayFormat("MMMM")
.DateInputFormat("MMMM")
.HtmlAttributes(new System.Collections.Generic.Dictionary<string, object>() { { "class", "financialDashboardDatePicker" } })
.TextAlignment(TextEditorTextAlignment.Left)
.DataMode(DateEditorDataMode.DisplayModeText)
.MinValue(new DateTime(1753, 1, 1))
.ValidatorOptions(options =>
{
options.Required(true, "*");
options.Date(true, "*");
options.OnBlur(false);
options.OnChange(false);
options.OnSubmit(false);
}
)
.Render()
)

I have tried .Datepickeroptions(x) but can find nowhere how I define x for month/date only. I have tried adding code you supplied elsewhere for this issue:

features.Updating().ColumnSettings(cs =>
{
cs.ColumnSetting().ColumnKey("StartDate").EditorType(ColumnEditorType.DatePicker).Required(true).EditorOptions("datepickerOptions: {changeYear: true, changeMonth: true}");
});

However, it won't accept featires, .Features. or any other variation on that like it would in an iggrid. Please help me on the proper syntax.

- John Cannon