Changing FirstVisibleTime of C1Schedule not updating in the UI

Posted by: C_S.Kalaivanan on 25 February 2019, 8:34 am EST

    • Post Options:
    • Link

    Posted 25 February 2019, 8:34 am EST

    Hi,

    I need to change the FirstVisibleTime through code at runtime, but it is not reflecting in C1Schedule UI. I tried the below code. Please help me in resolving this.

    c1Schedule1.Settings.FirstVisibleTime = new TimeSpan(8, 0, 0);

    c1Schedule1.Refresh();

    Thanks

    Kalaivanan S

  • Posted 26 February 2019, 3:01 am EST

    Hello,

    Please ensure that you have not set the MonthView for C1Schedule at your end as the FirstVisibleTime is not visible in this case. Refer the documentation related to the property:

    https://help.grapecity.com/componentone/NetHelp/c1schedule/webframe.html#C1.Win.C1Schedule.4~C1.Win.C1Schedule.C1ScheduleSettings~FirstVisibleTime.html

    With the other views, setting the property as in your code snippet should work.

    I have attached an application implementing the same. Executing the application, FirstVisibleTime is reflected on C1Schedule at runtime, as expected.

    In case the issue persists, kindly modify the attached sample and share it back so that I can observe the problem and assist you further.

    Best Regards,

    Esha

    prj_C1Schedule_FirstVisibleTime.zip

  • Posted 26 February 2019, 5:07 am EST

    Hi,

    I have modified and attached the sample. Added the combobox with the items 1 to 9 and in the combobox selectedindex changed event am trying to change the FirsVisibleTime but it is not updating. Please check this and assist me.

    Added the combobox item:

    this.comboBox1.Items.AddRange(new object {

    “1”,

    “2”,

    “3”,

    “4”,

    “5”,

    “6”,

    “7”,

    “8”,

    “9”,

    “10”});

    And in the comboBox1_SelectedIndexChanged

    private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)

    {

    c1Schedule1.Settings.FirstVisibleTime = new TimeSpan(Convert.ToInt32(comboBox1.SelectedItem), 0, 0);

    c1Schedule1.Refresh();

    }

    Thanks,

    Kalaivanan

    prj_C1Schedule_FirstVisibleTime_reply.zip

  • Posted 26 February 2019, 7:37 am EST

    Hello,

    FirstVisibleTime property is only honoured when you open the current view (for example, switch from the MonthView to TimeLine or DayView, etc).

    After you have scrolled over the view, or changed the time interval, actual first visible time might be different. This behavior is by design. This is why the value selected through combobox is not set as the FirstVisibleTime.

    As a workaround, you can set the ViewType to another view and then reset it to your original one, as follows:

      private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
            {
                if (c1Schedule1.ViewType == C1.Win.C1Schedule.ScheduleViewEnum.WeekView)
                {
                    c1Schedule1.ViewType = C1.Win.C1Schedule.ScheduleViewEnum.WorkWeekView;
                    c1Schedule1.ViewType = C1.Win.C1Schedule.ScheduleViewEnum.WeekView;
                }
                c1Schedule1.Settings.FirstVisibleTime = new TimeSpan(Convert.ToInt32(comboBox1.SelectedItem), 0, 0);
                c1Schedule1.Refresh();
            }
    

    This will now set the FirstVisibleTime as per the value selected in the combobox. The modified sample is attached for your reference.

    Regards.

    prj_C1Schedule_FirstVisibleTime_ViaComboBox.zip

  • Posted 26 February 2019, 7:57 am EST

    Hi,

    Thanks for the reply, Its working fine for me.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels