This question is locked. New answers and comments are not allowed.
Hi All,
I am using a DateTimePicker on a view that performs a search. This is also happening on a NumericTextBox on the same view. The controls are initialized after the ViewModel is initialized when the view is first shown. At that point they are displaying the right values from the View Model.
The problem is when the user fills one or more fields in and submits the search, the DateTimePickers and NumericTextBox do not hold the values the user entered as it comes back from the search. I can observe this in the debugger in the Ajax method(the [Grid Action]) right before the data is assigned to the Grid and the View returns. The adjacent typical MVC TextBox markup (below)
<%= Html.TextBoxFor(model => model.SearchCriteria.BatchNumber)%>works in that the model on post has those values. Any Telerik controls do not update the ViewModel they are bound to.
A bit more context, there is also a Telerik Grid on the View that shows the Results of the search that is using Ajax, and working perfectly. The first search works and the values are in the post for the dates but after the search returns (and in the debugger of the Ajax call that fires) the results are that the controls load the current date time.
And when you adjust the values to a different date and re-submit the view, the values are again not what was entered or selected. I am also not sure in the markup if you should be using (setting the value) the .Value property or not. I ahve tried it both ways.
Here is the markup for one of the two DateTimePickers ..
<%= Html.Telerik().DatePickerFor(ps => ps.SearchCriteria.SearchStartDate)
.Name("start-date")
.Value(Model.SearchCriteria.SearchStartDate)
.Min(( ( DateTimePickerAttributes ) Model.DateTimePickerSettings["start-date"] ).MinDate.Value)
.Max(( ( DateTimePickerAttributes ) Model.DateTimePickerSettings["start-date"] ).MaxDate.Value)
.ShowButton(Model.DateTimePickerModel.DateAttributes.ShowButton.Value)
.OpenOnFocus(Model.DateTimePickerModel.DateAttributes.OpenOnFocus.Value) %>
I have tried not addressing the .Value property and the result is the same. And again the NumericTextBox does not retain it's value as it comes back from the search (which is an ajax call) like the DateTimePickers.
Any help would be appreciated.
Thanks,
Reid