Appointment Colors Changing

10 posts, 0 answers
  1. Leela
    Leela avatar
    14 posts
    Member since:
    Jun 2010

    Posted 16 Jul 2010 Link to this post

    Hi,
    I am evaluating the Telerik RadScheduler .
    All most all our requirements are available in this except TimeSlot Horizental.
    I am facing some problems.

    1.

    Depending up on appointmetn start time and end time i have to change the colors.
    Ex: Appointments End Time lessthan the current time i have to show those appoinments in blue color
    Appoinments Start Time greater than the current time i have to show those appoinments in green color.

    While page loading and

    RadScheduler1_AppointmentDelete

      appointments are showing in the defined colors using

    RadScheduler1_AppointmentDataBound

    but when i am changing the start time and end time using drag and drop with in the scheduler

     

    RadScheduler1_AppointmentUpdate is calling and the color is not changing depending upon the above example logic.
    and when ever this event is calling RadScheduler1_AppointmentDataBound is not calling  


     

     

    protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e)

     

    {

    int

     

    id = (int)e.ModifiedAppointment.ID;

     

     

    string duration = e.ModifiedAppointment.Duration.ToString();

     

     

    string starttime = e.ModifiedAppointment.Start.TimeOfDay.ToString();

     

     

    string endtime = e.ModifiedAppointment.End.TimeOfDay.ToString();

     

     

    string date = e.ModifiedAppointment.Start.ToShortDateString();

     

     

    int resourceId = (int)e.ModifiedAppointment.Resources.GetResourceByType("Chair").Key;

     

    ScheduleUpdate(id, starttime, endtime, duration, date, resourceId);

     

     

    //Change the appointment colors which are already closed i.e appointmetn end time less than the current time.

     

     

     

     

     

     

    if (Convert.ToDateTime(e.ModifiedAppointment.End) < Convert.ToDateTime(DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString()))

     

    {

    e.Appointment.BackColor = System.Drawing.

    Color.Gray;

     

    e.Appointment.ForeColor = System.Drawing.

    Color.White;

     

    }

     

    //Change the appointment colors which are not started i.e appointmetn start time greater than the current time.

     

     

     

     

     

     

    else if (Convert.ToDateTime(e.ModifiedAppointment.Start) > Convert.ToDateTime(DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString()))

     

    {

    e.Appointment.BackColor = System.Drawing.

    Color.Yellow;

     

    e.Appointment.ForeColor = System.Drawing.

    Color.Blue;

     

    }

     

    else

     

     

     

     

     

    {

    e.Appointment.BackColor = System.Drawing.

    Color.Green;

     

    e.Appointment.ForeColor = System.Drawing.

    Color.White;

     

    }

     

    RadScheduler1.Rebind();

     

     

    RadGrid1.Columns[3].Visible = true;

     

    RadToolTipManager2.TargetControls.Clear();

    RadGrid1.Rebind();

    RadGrid1.Columns[3].Visible =

    false;

     

    RadAjaxManager1.AjaxSettings.AddAjaxSetting(RadScheduler1, RadScheduler1);

     

     

    RadAjaxManager1.AjaxSettings.AddAjaxSetting(RadScheduler1, RadToolTipManager1);

     

     

     

    }


    2.
    How to restrict the users to resize the appoinments with out customizing. Is there any inbuilt property in scheduler control.
    3.

     

     

    ShowHoursColumn="False"

     

    I set the property of the scheduler but its showing the vertical line . I want to remove that line. Is there any way to remove that line from GUI.

    4.
    In Hours Column time (08:00) is showing top of the TimeLabelSpan but i want to set to middle of the TimeLabelSpan.

    5.
    I added some contextMenuItems to the appointments and when ever i click on contextMenuItem its opening a new browser.
    But i want to open the contextMenuItem windows as popups.
    Is there any inbuilt feature to achieve this.

    6.How to change the color of 2 timeslots (30 mints) after the each Appointment End Time to RED color.

    7. In

     

    RadScheduler1_AppointmentUpdate

    Event i am getting the below error and data is updating correctly.

     

    Sys.WebForms.PageRequestMangerServerErrorException: Procedure or function UpdateDetails has too many arguments specified.
    How rosolve the above error.
    Code:

     

    IDataSource

     

    dataSource = SchedulerDataSource;

     

     

    DataSourceView view = dataSource.GetView("DefaultView");

     

     

    IDictionary keys = new OrderedDictionary();

     

     

    IOrderedDictionary data = new OrderedDictionary();

     

    data.Add(

    "UPStartTime", starttime);

     

    data.Add(

    "UPEndTime", endtime);

     

    data.Add(

    "UPDuration", duration);

     

    data.Add(

    "UPUpdatedBy", "242675");

     

    data.Add(

    "UPDate", date);

     

    data.Add(

    "UPChairId", resourceId);

     

    data.Add(

    "UPAppointmentID", id);

     

     

    int j = data.Count;

     

    view.Update(keys, data ,

    new OrderedDictionary(), OnDataSourceOperationComplete);

     

     

    I tried to resolve using the  onupdating="SchedulerDataSource_Updating" event to remove the extra Parameters added by VS.

     

     

     

    8.

     

    TimeSlotContextMenus are showing when user click on resources. How to restirct it.

     

     

    9.
    In RadGrid there are 5 columns and i want to give sorting feature to only 2 columns in that grid but in the front end users are able to 
    sort using all the columns. How to restrict some columns for sorting by clicking on the grid columns. 

     

     

    <SortExpressions>

     

     

     

    <telerik:GridSortExpression FieldName="TeammateName" SortOrder="Ascending" />

     

     

     

    <telerik:GridSortExpression FieldName="Role" SortOrder="Ascending" />

     

     

     

    </SortExpressions>

    10.Please go through the attached screen and the questions about the attached screen shot are
       

     

    1. How to remove the blue color in b/t the two schedulers.

    2. Whenever I click on New Appointment its showing like below.

    3. Whenever we are moving the appointments we are getting the below java script error.



     

     

     



    Please Give any suggestions ASAP.
    Please suggest any reference links for all the above points.
    Thanks in advance.





  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 22 Jul 2010 Link to this post

    Hello Leela,

    Handling AppointmentDataBound like this should be sufficient to achieve your requirement:
    protected void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e)
        {
            if (e.Appointment.Start < DateTime.Now)
                e.Appointment.BackColor = System.Drawing.Color.Green;
        }

    This is because after an update of an appointment (whether from dragging or any other means) RadScheduler is rebound and AppointmentDataBound occurs for all appointments.

    To keep the rounded corners and gradients, you can set AppointmentStyleMode="Default" for RadScheduler.



    Kind regards,
    Peter
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Leela
    Leela avatar
    14 posts
    Member since:
    Jun 2010

    Posted 22 Jul 2010 Link to this post

    Thanks for your reply.
     Please reply the answers to all the mentioned points as eary as possible.
    We have to clarify the above posted all points to our client.

    1)
    RadScheduler source code:

     

    <telerik:RadScheduler ID="RadScheduler1" runat="server" Skin="WebBlue"

     

     

    GroupBy ="Chair" ShowFooter="False"

     

     

    DataSourceID="SchedulerDataSource" DataKeyField="AppointmentID"

     

     

    DataStartField="StartTime" DataEndField="EndTime"

     

     

    DataSubjectField="PatientName"

     

     

    onappointmentupdate="RadScheduler1_AppointmentUpdate" OnAppointmentDataBound ="RadScheduler1_AppointmentDataBound"

     

     

    onappointmentdelete="RadScheduler1_AppointmentDelete" MinutesPerRow="15" OnAppointmentCommand ="RadScheduler1_AppointmentCommand"

     

     

    ShowAllDayRow="False" TimeLabelRowSpan="4"

     

     

    NumberOfHoveredRows="1" onappointmentcreated="RadScheduler1_AppointmentCreated"

     

     

    ondatabound="RadScheduler1_DataBound" HoursPanelTimeFormat ="hh:mm" ColumnWidth="30px"

     

     

    RowHeight="15px" Height ="100%" Width="660px" OverflowBehavior ="Expand"

     

     

    DisplayDeleteConfirmation="False" ShowHeader="false"

     

     

    ShowHoursColumn="False" >

     

     

     

    <DayView DayEndTime="20:00:00" ShowHoursColumn="False" />

     

     

     

    <AdvancedForm Modal="true" />

     

     

    <MonthView DayHeaderDateFormat="dd MMM" MinimumRowHeight="5"

     

     

    VisibleAppointmentsPerDay="3" />

     

     

    <ResourceTypes >

     

     

    <telerik:ResourceType KeyField ="ChairId" Name ="Chair" TextField ="ChairName" DataSourceID ="ChairsDatasource" ForeignKeyField ="ChairId" />

     

     

    </ResourceTypes>

     

     

    <TimelineView UserSelectable="False" />

     

     

    <AppointmentTemplate>

     

    <%

    # Eval("Subject") %>

     

     

    <asp:Button ID="UnscheduleAppointment" CssClass="simpleButton" CommandName="Unschedule"

     

     

    ToolTip="Unschedule this appointment" runat="server" />

     

     

    </AppointmentTemplate>

     

     

    <AppointmentContextMenus>

     

     

    <telerik:RadSchedulerContextMenu ID="RadSchedulerContextMenu1" runat="server">

     

     

    <Items>

     

     

    <telerik:RadMenuItem runat="server" NavigateUrl="~/Scheduler.aspx"

     

     

    PostBack="False" Target="_blank" Text="Change Treatment Time">

     

     

    </telerik:RadMenuItem>

     

     

    <telerik:RadMenuItem runat="server" NavigateUrl="~/Scheduler.aspx"

     

     

    PostBack="False" Target="_blank" Text="Remove Temporarily ">

     

     

    </telerik:RadMenuItem>

     

     

    <telerik:RadMenuItem IsSeparator="true" />

     

     

    <telerik:RadMenuItem runat="server" PostBack="False" Text="Close Menu">

     

     

    </telerik:RadMenuItem>

     

     

    </Items>

     

     

    </telerik:RadSchedulerContextMenu>

     

     

    </AppointmentContextMenus>

     

     

     

     

     

     

    <MultiDayView UserSelectable="True" />

     

     

     

    <TimeSlotContextMenuSettings EnableDefault="false" />

     

     

    <AppointmentContextMenuSettings EnableDefault="true" />

     

     

    </telerik:RadScheduler>

     



    Code Behind:

    AppointmentDataBound is already exists in my code but this event is not firing when ever AppointmentUpdate event is firing.

     

    protected void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e)

     

    {

     

    //Change the appointment colors which are already closed i.e appointmetn end time less than the current time.

     

     

    if (Convert.ToDateTime(e.Appointment.End) < Convert.ToDateTime(DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString()))

     

    {

    e.Appointment.BackColor = System.Drawing.

    Color.Gray;

     

    e.Appointment.ForeColor = System.Drawing.

    Color.White;

     

    }

     

    //Change the appointment colors which are not started i.e appointmetn start time greater than the current time.

     

     

    else if (Convert.ToDateTime(e.Appointment.Start) > Convert.ToDateTime(DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString()))

     

    {

    e.Appointment.BackColor = System.Drawing.

    Color.Yellow;

     

    e.Appointment.ForeColor = System.Drawing.

    Color.Blue;

     

    }

     

    else

     

    {

    e.Appointment.BackColor = System.Drawing.

    Color.Green;

     

    e.Appointment.ForeColor = System.Drawing.

    Color.White;

     

    }

     

    }

  5. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 28 Jul 2010 Link to this post

    Hello Leela,

    I have missed the other questions, since they looked as part of the code sample that you sent. Apologies for this.

    2. How to restrict the users to resize the appoinments with out customizing. Is there any inbuilt property in scheduler control.

    A: The resize handle can be hidden with css:
    <style type="text/css"
    .rsAptResize 
      visibility:hidden!important
    </style> 

    3. ShowHoursColumn="False" . I set the property of the scheduler but its showing the vertical line . I want to remove that line. Is there any way to remove that line from GUI.

    A: If I understand you correctly, then the following jQuery workaround will help you with this requirement:
    <script type="text/javascript">
           function pageLoad() {
               $telerik.$(".rsVerticalHeaderWrapper").hide();
               $telerik.$(".rsSpacerCell").hide();
               $find('<%=RadScheduler1.ClientID %>').repaint();
           }
       </script>


    4. In Hours Column time (08:00) is showing top of the TimeLabelSpan but i want to set to middle of the TimeLabelSpan.

    A: Doesn't this requirement conflict with the one from question 3 above which hides the hours column? Let me know if I am missing something.

    5.I added some contextMenuItems to the appointments and when ever i click on contextMenuItem its opening a new browser.
    But i want to open the contextMenuItem windows as popups.
    Is there any inbuilt feature to achieve this.

    A: Instead of setting the NavigateUrl property of the items, you can use the Value property and handle
    OnClientAppointmentContextMenuItemClicking event to open a RadWindow for example.

    6.How to change the color of 2 timeslots (30 mints) after the each Appointment End Time to RED color.

    A: Please, use this kb article for reference:
    http://www.telerik.com/support/kb/aspnet-ajax/scheduler/setting-special-days-or-time-slots-in-radscheduler.aspx

    7. RadScheduler1_AppointmentUpdate  - Event i am getting the below error and data is updating correctly.
    Sys.WebForms.PageRequestMangerServerErrorException: Procedure or function UpdateDetails has too many arguments specified.

    A: This problem seems related to your datasource or implementation. We cannot say why it occurs without a working test project which we could debug locally.

    8. TimeSlotContextMenus are showing when user click on resources. How to restirct it.

    A: This should cure the problem:
    function pageLoad() {
              $telerik.$(".rsHorizontalHeaderTable").bind("contextmenu", function (e) { 
                  return false;              
              }); 
          }


    9. In RadGrid there are 5 columns and i want to give sorting feature to only 2 columns in that grid but in the front end users are able to
    sort using all the columns. How to restrict some columns for sorting by clicking on the grid columns.

    A: To achive this functionality you could try setting the RadGrid's AllowSorting property to true and set AllowSorting="false" to all columns which you do not want to be sortable. You can use this demo for reference:http://demos.telerik.com/aspnet-ajax/grid/examples/programming/sort/defaultcs.aspx


    Best wishes,
    Peter
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Leela
    Leela avatar
    14 posts
    Member since:
    Jun 2010

    Posted 29 Jul 2010 Link to this post

    Thanks for your reply.
    1. RadScheduler1_AppointmentDataBound is not calling when ever RadScheduler1_AppointmentUpdate is calling that's why i am unable to change the appointment colors when ever user resized the appointment.

    2. In a single page i had 2 radscheduler contorls but i want to remove the resize property of appointments in 1 radscheduler control
    how to remove it.If i using the below script its disabling the appointments in both radscheduler controls.

    <

     

    style type="text/css">

     

     

    .rsAptResize

     

     

    {

     

    visibility:hidden!important;

     

    }

    </

     

    style>

     

    3.
    <script type="text/javascript">
           functionpageLoad() {
               $telerik.$(".rsVerticalHeaderWrapper").hide();
               $telerik.$(".rsSpacerCell").hide();
               $find('<%=RadScheduler1.ClientID %>').repaint();
           }
       </script>
    The code is working fine for removing ShowHoursColumn from the radscheduler control but in my screen i had 2 radscheduler controls
    and i want to remove the column for 1 radscheduler control. What changes i have to do for reflecting the above code for 1 radscheduler control.
    4. As mentioned in the above point in one radscheduler control time slot i want to show the hours in the middle of time lable span.


    Thanks in advance.

     
  7. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 29 Jul 2010 Link to this post

    Hello Leela,

    1. Try calling RadScheduler1.Rebind() in AppointmentUpdate.

    2. and 3. Please, the following code, where 'RadScheduler1' will be the ID of your target scheduler:

    function pageLoad() {
               var scheduler1Element = $find('<%=RadScheduler1.ClientID %>').get_element();
               $telerik.$(".rsAptResize", scheduler1Element).hide();
               $telerik.$(".rsVerticalHeaderWrapper", scheduler1Element).hide();
               $telerik.$(".rsSpacerCell", scheduler1Element).hide();
               $find('<%=RadScheduler1.ClientID %>').repaint();
           }

    4. I am afraid this is not possible since when you set TimeLabelRowSpan="4" the time shows only for the first row out of every 4 rows.


    Best wishes,
    Peter
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Leela
    Leela avatar
    14 posts
    Member since:
    Jun 2010

    Posted 30 Jul 2010 Link to this post

    Thank you very much for your prompt reply.
    1.
    I am using RadScheduler1.Rebind even then also its not working and one thing what i observed is RadScheduer1_AppointmentDataBound is not firing when ever RadScheduler1_AppointmentUpdate is firing that's why i am setting the color of the modified appointment in the RadScheduler1_AppointmentUpdate funtion then also its not working.
    Please check the below code and let me know where i am doing mistake.

    protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e)

     {

     

    int id = (int)e.ModifiedAppointment.ID;

     string duration = e.ModifiedAppointment.Duration.ToString();

     string starttime = e.ModifiedAppointment.Start.TimeOfDay.ToString();

     string endtime = e.ModifiedAppointment.End.TimeOfDay.ToString();

     string date = e.ModifiedAppointment.Start.ToShortDateString();

     int resourceId = (int)e.ModifiedAppointment.Resources.GetResourceByType("Chair").Key;

     ScheduleUpdate(id, starttime, endtime, duration, date, resourceId); //In this function i am updating the details in the Database.

      //Change the appointment colors which are already closed i.e appointmetn end time less than the current time.

     if (Convert.ToDateTime(e.ModifiedAppointment.End) < Convert.ToDateTime(DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString()))

    {

    e.Appointment.BackColor = System.Drawing.

     

    Color.Gray;

     e.Appointment.ForeColor = System.Drawing.

     

    Color.White;

    }

     //Change the appointment colors which are not started i.e appointmetn start time greater than the current time.

    else if (Convert.ToDateTime(e.ModifiedAppointment.Start) > Convert.ToDateTime(DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString()))

     {

    e.Appointment.BackColor = System.Drawing.

     

    Color.Yellow;

     e.Appointment.ForeColor = System.Drawing.

     

    Color.Blue;

     }

     else

     {

    e.Appointment.BackColor = System.Drawing.

     

    Color.Green;

     e.Appointment.ForeColor = System.Drawing.

     

    Color.White;

     }

     RadScheduler1.Rebind();

     

     RadGrid1.Columns[3].Visible = true;

     RadToolTipManager2.TargetControls.Clear();

    RadGrid1.Rebind();

    RadGrid1.Columns[3].Visible =

     

    false;

     RadAjaxManager1.AjaxSettings.AddAjaxSetting(RadScheduler1, RadScheduler1);

     RadAjaxManager1.AjaxSettings.AddAjaxSetting(RadScheduler1, RadToolTipManager1);

     }

     

     

    protected void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e)

     

    {

     

    //Change the appointment colors which are already closed i.e appointmetn end time less than the current time.

     

     

     

     

     

    if (Convert.ToDateTime(e.Appointment.End) < Convert.ToDateTime(DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString()))

     

    {

    e.Appointment.BackColor = System.Drawing.Color.Gray;

    e.Appointment.ForeColor = System.Drawing.Color.White;

    }

     

    //Change the appointment colors which are not started i.e appointmetn start time greater than the current time.

     

     

     

     

     

    else if (Convert.ToDateTime(e.Appointment.Start) > Convert.ToDateTime(DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString()))

     

    {

    e.Appointment.BackColor = System.Drawing.Color.Yellow;

    e.Appointment.ForeColor = System.Drawing.Color.Blue;

    }

     

    else

     

     

     

     

    {

    e.Appointment.BackColor = System.Drawing.Color.Green;

    e.Appointment.ForeColor = System.Drawing.Color.White;

    }

     

    }

     

  9. T. Tsonev
    Admin
    T. Tsonev avatar
    2772 posts

    Posted 05 Aug 2010 Link to this post

    Hello Leela,

    You don't need to call Rebind() explicitly in AppointmentUpdate. On the contrary, this is likely to be creating some of the problems you see.

    Let the operation complete and RadScheduler will rebind itself automatically, as long as you've set DataSourceID, DataSource or you're using a Provider.

    I hope this helps.

    All the best,
    Tsvetomir Tsonev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  10. Eva
    Eva avatar
    19 posts
    Member since:
    May 2012

    Posted 01 Nov 2013 Link to this post

    Hello,

    i have the same problem as described above. i bind radscheduler on page load using sql and sqldataAdapter. i use

    AppointmentDataBound for changing the color in the appointments created. but when i resize an appointment the color returns to default. how can i solve this?

  11. Ivan Zhekov
    Admin
    Ivan Zhekov avatar
    539 posts

    Posted 04 Nov 2013 Link to this post

    Hi, Eva.

    There was a such known issue with 2013 Q3 release, but we target it in a later service pack. Could you obtain an internal build and test if the issue is resolved?

    If the issue is not resolved, perhaps it's related to something else and we may need you to send us samples of your code for debugging.

    Regards,
    Ivan Zhekov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017