We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Just wondering...

Thread ID:





130750 May 30,2017 10:43 PM UTC Jun 1,2017 01:21 PM UTC ASP.NET MVC 1
Tags: DateTimePicker
Bernard Jurlina
Asked On May 30, 2017 10:43 PM UTC

Is there some way to hold "configuration", for example, for all DateTimePickerFor controls in all views?
If I have DateTimePickerFor like this: 
@Html.EJ().DateTimePickerFor(model => model.DatumOd).Width("250px").Locale("hr-HR").DateTimeFormat("dd.MM.yyyy. HH:mm").ShowRoundedCorner(true)DateTimePickerButtonText(text => text.Today("Danas").TimeNow("Vrijeme sada").Done("Prihvati").TimeTitle("Vrijeme"))

Can this part ".Locale("hr-HR").DateTimeFormat("dd.MM.yyyy. HH:mm").ShowRoundedCorner(true)DateTimePickerButtonText(text => text.Today("Danas").TimeNow("Vrijeme sada").Done("Prihvati").TimeTitle("Vrijeme"))" be somehow globally controlled? So, instead of write that long "config" every time, maybe to be like .Config("DateTimePickerOptions"), where "DateTimePickerOptions" is some kind of JSON to hold that options.
And, when I want to change that for all the DateTImePicker controls, I can do it in just one place.


Shameer Ali Baig Sulaiman Ali Baig [Syncfusion]
Replied On June 1, 2017 01:21 PM UTC

Hi Bernard, 
Thanks for contacting Syncfusion support. 
We have checked with your query. We can able to hold the properties of DateTimePickerFor using Session object in a single base controller and then we can use the session objects from other controllers with minimum effort. We have prepared a work around to meet your requirement. In DatePickerController, properties of DatetimePickerFor is stored in session object and it is used by the HomeController.  
public ActionResult DatePickerFeatures(DateTime_pick model) 
            DateTime_pick dat1 = new DateTime_pick(); 
            dat1.datepic = DateTime.Now; 
            DateTimePickerProperties dt = new DateTimePickerProperties(); 
            dt.DisplayInline = true; 
            dt.DateFormat = "dd/MMM/yyyy"; 
            Session["data"] = dt; 
            return View(model); 
public ActionResult Index(DateTime_pick model) 
            DateTime_pick dat1 = new DateTime_pick(); 
            dat1.datepic = DateTime.Now; 
            DateTimePickerProperties dt = new DateTimePickerProperties(); 
            var datas = Session["data"] as DateTimePickerProperties; 
            return View(model); 
@model SyncfusionMvcApplication5.Models.DateTime_pick 
<div class="control"> 
@Html.EJ().DateTimePickerFor(model => model.datepic,(Syncfusion.JavaScript.Models.DateTimePickerProperties)Session["data"]) 
@model SyncfusionMvcApplication5.Models.DateTime_pick 
@Html.EJ().DateTimePickerFor(model => model.datepic, (Syncfusion.JavaScript.Models.DateTimePickerProperties)Session["data"]) 
Session Object will be initialized in a controller which is first invoked by the application and then it can be accessible from all other controller. In the view of corresponding controller, we can use the session data as used in the above code.  
Sample: DateTimePicker  
Please, use the following links to know more about Session in ASP.NET MVC  
Please let us know if you need any further assistance. 
Shameer Ali Baig S 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon