May 19, 2015, 10:39 AM
Date picker of Month Year Type > Set Date Value Manually
Hi,
I am using Ext.net version 2.2.0.26551
In that I am using DatePicker with MonthYear type as follows,
I am using Ext.net version 2.2.0.26551
In that I am using DatePicker with MonthYear type as follows,
X.DateFieldFor(model => Model.ScenarioDetails.SCENARIO_EXECUTION_DATE)
.Type(DatePickerType.Month).ID("txtScenarioDate").StartDay(1)
.Editable(false).FieldLabel("").LabelCls("fieldLabelTop")
.LabelAlign(LabelAlign.Top).MsgTarget(MessageTarget.Side)
.PickerOptions(new DatePicker() { Height = 200 })
.Format(monthYearDateFormat).Width(190).ReadOnly(ReadOnlyMode)
.Listeners(ls => ls.Change.Handler = "SetDateForMonthPicker(this, true)")
I am using following JS script to set the date (first or end date of the month depending upon the flag)var SetDateForMonthPicker = function (txtControl, setEndDate) {
var year = txtControl.getPicker().getValue()[1],
month = txtControl.getPicker().getValue()[0],
lastDay = new Date(year, month + 1, 0),
firstDay = 1,
dateToSet;
if (setEndDate != undefined && setEndDate) {
dateToSet = new Date(year, month, lastDay.getDate());
}
else {
dateToSet = new Date(year, month, 1);
}
txtControl.setValue(new Date(year, month, firstDay));
txtControl.el.update();
}
BUT STILL I GET THE CURRENT DATE