State Persistence in EJ 1 ASP.NET Core DatePicker

You can sustain the entire widget model of EJMVC DatePicker even after form post or browser refresh by using EnablePersistence property. So the entire model values such as

  • Selected date
  • Highlighted date
  • Start and depth level

are stored in local storage / cookies of browser before page refreshes and reinitialized with the restored model after refresh.

  • cshtml
  • /*ej-Tag Helper code to render DatePicker*/
    
        @*persists the DatePicker model*@
    
        <ej-date-picker id="datepick" enable-persistence="true"></ej-date-picker>
  • cshtml
  • /*Razor code to render DatePicker*/
    
         @{Html.EJ().DatePicker("datepick").EnablePersistence(true).Render(); }

    NOTE

    To render the DatePicker Control you can use either Razor or Tag helper code as given in the above code snippet.