State Persistence

12 Jun 20231 minute to read

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.

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


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