Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
633
UltraMonthViewMulti - Get/Set ActiveDay
posted

This seems that this should be an incredibly easy taks, however, I can't seem to figure it out.... I have figured out on way of retrieving the Selected Date in the UltraMonthViewMulti control but it only work if i have a CalendarInfo object on the form, and have it referenced from my instance of the monthmulitview control. By accessing the UltraMonthViewMulti.CalendarInfo.ActiveDay, I can retrieve the currently selected date.

 My problem comes in with trying to set the date... say when the user comes into the form for the first time, I need to remember what they selected the previous time (stored in db) and set it here.... A seemingly simple task... I tried creating a new instance of the "Day" object but it has no constructor, so it will not allow creation. ..... I just tried to declare it as a Value type which initially looked like it may work... but wouldn't you know it, it's Date property is ReadOnly... so back to square one.

Ultimately, I'm just trying to add an equivalent of Microsoft's MonthCalendar control, I haven't been able to find one in Infragistics, and the UltraMonthViewMulti seems to resemble it the closest... the reason I have to use an Infragistics control is becuase we are using AppStyling in the application and need the style to propogate across all controls.

 Thanks in advance for your help! :)

  • 633
    Verified Answer
    posted

    Well... it seems I answered my own question, and it wasn't completely straight forward, but it works!? If there is an easier, please let me know!? :)

     //To set the ActiveDay

    StartDateMonthViewMulti.CalendarInfo.SelectedDateRanges.Clear();

    StartDateMonthViewMulti.CalendarInfo.SelectedDateRanges.Add(Convert.ToDateTime(myObject.StartDate));

    StartDateMonthViewMulti.CalendarInfo.ActiveDay = StartDateMonthViewMulti.CalendarInfo.SelectedDateRanges[0].FirstDay;

     

    //To get the ActiveDay

    myObject.StartDate = StartDateMonthViewMulti.CalendarInfo.ActiveDay.Date;

     

    ~Scott