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
close icon

Current displayed dates

Hello,
there's a way to get the current displayed dates range in schedulecontrol item?

7 Replies

AK Adhikesevan Kothandaraman Syncfusion Team May 31, 2016 02:11 PM UTC

Hi Dario, 

Thanks for using Syncfusion products. 

We have analyzed your reported Query at our end.  We need some more information about your requirement. Can you please let us know the following, 
 
1.       What you are meant by the term “date’s range”? 
2.       Whether you need to get the date displayed in the Navigation Panel or in the SchduleGrid? 


  

Regards, 
Adhi 



DF Dario Fraschini May 31, 2016 02:24 PM UTC

Hello, thanks for your attention.

I need the date range displayed by the Schedule Grid.
My goal is to print the actual view to a report and, to do so, I need the starting date and the ending date being sent to the report parameters.
How can I achive that?


AK Adhikesevan Kothandaraman Syncfusion Team June 1, 2016 05:34 PM UTC

Hi Dario, 

Thanks for your update. 

We have analyzed your scenario at our end. The schedule control does not have the default support to get the start date and end date of the scheduleGrid. If you want to get the date range displayed in the Schedule UI, you can achieve this with some workaround using the AppointmentShowing event. In this event you can get the StartTime of the appointment. Please refer to the following code snippet, 

Code Snippet: 
this.scheduleControl1.ShowingAppointmentForm += new ShowingAppointmentFormHandler(scheduleControl1_ShowingAppointmentForm); 
 
void scheduleControl1_ShowingAppointmentForm(object sender, ShowingAppointFormEventArgs e) 
    DateTime startDate = e.Item.StartTime.Date; 
    //TimeSpan spann = new TimeSpan(); 
    DateTime endDate =startDate.AddDays(34); 
    ///startDate.Add(); 
    MessageBox.Show(e.Item.StartTime.Date.ToString()+""+ endDate.ToString()); 
 
Regards, 
Adhi 



DF Dario Fraschini June 6, 2016 09:45 AM UTC

...and what am I supposed to do with the start date of the appointment?
I need the current displayed schedule date range, so I don't understand what I can do with the starting date of one item....

Is it possible to get at least the scheduler start display date? With this and getting the view mode (month, week, workweek) I can achieve what I need.


AK Adhikesevan Kothandaraman Syncfusion Team June 7, 2016 12:41 PM UTC

Hi Dario, 
  
Thanks for your update. 
  
In our previous update, we have provided the solution for getting the start date value by clicking the appointment cell. You can also use the DrawCellDisplayText event to get the start date of the schedule grid. Using this event, you can get the display text of the particular cell. You can use this text to get the start date of the grid. please make use of the following code snippet and sample, 
  
Code Snippet: 
this.scheduleControl1.GetScheduleHost().DrawCellDisplayText += newSyncfusion.Windows.Forms.Grid.GridDrawCellDisplayTextEventHandler(Form1_DrawCellDisplayText); 
  
string displayText = null; 
void Form1_DrawCellDisplayText(object sender, Syncfusion.Windows.Forms.Grid.GridDrawCellDisplayTextEventArgs e) 
{ 
    if (e.RowIndex == 1 && e.ColIndex == 1) 
        displayText = e.Style.Text; 
} 
  
private void button1_Click(object sender, EventArgs e) 
{ 
    string[] list = displayText.Split(new char[] { '' }); 
    //Get the date from the display text 
    DateTime startDate = DateTime.Parse(list[0], this.scheduleControl1.Culture).Date; 
    //Display the start date 
    MessageBox.Show(startDate.ToString()); 
} 
  
Sample: 
 
Regards, 
Adhi 



DF Dario Fraschini June 15, 2016 09:43 AM UTC

I could reach the goal getting the selected dates in the calendar, in this way I know the days displayed on schedulecontrol.


AK Adhikesevan Kothandaraman Syncfusion Team June 16, 2016 04:29 AM UTC

Hi Derek, 

Thanks for your update. 

We are glad to hear that your goal has been reached. Please let us know, if you need any further assistance. 

Regards, 
Adhi 


Loader.
Live Chat Icon For mobile
Up arrow icon