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. Image for the cookie policy date

Date Range Picker StartDay + Ranges

Dear,

I use ASP.NET webforms in VB.NET.

Question 1:
Is there a possibility to set the StartDay for the Date Range Picker like we can do for the DatePicker? For example start the weeks on monday instead of sunday?

Question 2:
I would like to add the easy range buttons (Last Week/Month). When I add the code to  my Page_Load sub it only shows the "Customer Picker" button and not the "Last week" & "Last month buttons."

            datFilterOrderFromTo.Ranges.AddRange({New Syncfusion.JavaScript.Models.DateRanges() With {
                .Label = "Last Month",
                .Range = New List(Of Object)() From {
                    Today.AddMonths(-1).ToString(),
                    Today.ToString()
                }
            }, New Syncfusion.JavaScript.Models.DateRanges With {
                .Label = "Last Week",
                .Range = New List(Of Object)() From {
                    Today.AddDays(-7).ToString(),
                    Today.ToString()
                }
            }})



Thanks for help.
Peter

3 Replies

KR Keerthana Rajendran Syncfusion Team November 18, 2019 12:15 PM UTC

Hi Peter, 
 
Thanks for contacting Syncfusion support. 
 
Query 1: Is there a possibility to set the StartDay for the Date Range Picker like we can do for the DatePicker? For example, start the weeks on monday instead of sunday? 
 
Yes. It is possible. For this scenario, you can use DateRangePicker component open event to change the startDay for both the left and right date pickers. 
 
 
function onOpen(args) { 
            this._leftDP.option("startDay",1); 
           this._rightDP.option("startDay",1); 
        } 
 
 
Query 2: I would like to add the easy range buttons (Last Week/Month). When I add the code to my Page_Load sub it only shows the "Customer Picker" button and not the "Last week" & "Last month buttons." 
 
By default, our DateRangePicker component Custom Picker button visible to UI. Your provided code blocks are enough to add any custom buttons in DateRangePicker. Please refer the below sample and screenshot. 
 
 
 
 
If the issue persists, kindly modify the above sample based on your scenario else share the complete code block of DateRangePicker along with Layout and web config page details to proceed further.  
 
Regards, 
Keerthana. 



PE Peter November 18, 2019 05:38 PM UTC

Dear,

thank you for the reply. Question 1 is solved.
When I run your sample for Question 2 I get the same behaviour: no buttons for Last Month and Last Week, only Custom Picker.


To compile I had to remove this line from Global.Asax.vb:

        System.Web.Http.GlobalConfiguration.Configuration.Routes.MapHttpRoute(name:="DefaultApi", routeTemplate:="api/{controller}/{action}/{id}", defaults:=New With {.id = RouteParameter.[Optional]
        })

Any toughts?


KR Keerthana Rajendran Syncfusion Team November 19, 2019 10:50 AM UTC

Hi Peter, 
 
Good day to you, 
 
We have tested our shared sample, Last week and Last month button was added correctly. We were unable to replicate the issues mentioned in your update. We have recorded a video for your reference.  
Refer to the below link. 
 
 
Please check the above video and provide additional details on the following to proceed further. 
 
1.      Complete code block for ejDateRangePicker. 
2.      Video on the issue along with product version in which you get this issue. 
 
Regards, 
Keerthana.  


Loader.
Live Chat Icon For mobile
Up arrow icon