0

I have created a datepicker using :

@Html.TextBoxFor(model => model.DateTo, new { @class = "form-control DateTo" })

and

   $(".DateTo").datepicker({
    dateFormat: 'dd/mm/yy',
    numberOfMonths: 1,
    autoclose: true,   
 });

and in the view model : [Display(Name = "To")] public string DateTo { get; set; }

and have updated the field DateTo and passing that to view in the controller as:

  return view(searchviewModel); 

In the searchviewModel, the DateTo is set to 26/11/2014. Where as when I get the page, it is caching old values and not resetting to this value.

Any input on this will be helpful.

test acc
  • 3
  • 1

1 Answers1

0

ModelState.Clear()

Asp.net MVC ModelState.Clear.

If you retreive value via an ajax call, set the cache:false

Community
  • 1
  • 1
Mathieu Labrie Parent
  • 2,598
  • 1
  • 9
  • 10