This is a migrated thread and some comments may be shown as answers.

Urgent : How to Bind more Values in the RadScheduler

1 Answer 135 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Brijesh
Top achievements
Rank 1
Brijesh asked on 01 Dec 2010, 02:21 PM
Hi..

I Am using  Rad Scheduler in my web application. 

I have almost done with the basic functionality, But i have a issue that is I want to display the Different value in the Subject, Description and i want an extra value using that i want to set the the CSS for the Appointment.


such as  
SubjectId="1"
Subject = "Task"
Description = "This is a Task."
TypeId= 1

SubjectId="10"
Subject = "TroubleTicket"
Description = "This is a TroubleTicket."
TypeId= 2

so on radsch_AppointmentDataBound() event
I am checking  following condition.
 
if( e.Appointment.TypeId==1)
            {
                e.Appointment.CssClass = "rsCategoryYellow";
            }
            else if (e.Appointment.TypeId== 2)
            {
                e.Appointment.CssClass = "rsCategoryRed";
            }
            else 
            {
                e.Appointment.CssClass = "rsCategoryGreen";
            }           

-- right now i have used in subectid (Following code)

if( e.Appointment.Subject == Convert.ToString((int)EventType.Task))
            {
                e.Appointment.CssClass = "rsCategoryYellow";
            }
            else if (e.Appointment.Subject == Convert.ToString((int)EventType.TroubleTicket))
            {
                e.Appointment.CssClass = "rsCategoryRed";
            }
            else 
            {
                e.Appointment.CssClass = "rsCategoryGreen";
            }           

-- also I m attaching my code to.

Aspx
 <telerik:RadScheduler ID="radschMyCalendar" runat="server" Width="100%" DataKeyField="PrimeId"
                    DataStartField="StartDateTime" StartEditingInAdvancedForm="true" DataEndField="DueDateTime"
                    DataSubjectField="TypeId" DataDescriptionField="Description" ShowAllDayRow="true"                    
                    Culture="en-US" Height="100%" SelectedView="MonthView" AllowDelete="false" FirstDayOfWeek="Monday"
                    LastDayOfWeek="Sunday" OnAppointmentDataBound="radschMyCalendar_AppointmentDataBound">
                    <MultiDayView UserSelectable="false" />
                    <AdvancedForm Modal="true" />
                    <TimelineView UserSelectable="false" />
                    <AppointmentContextMenuSettings EnableDefault="true" />
                    <AppointmentTemplate>
                        <div>                            
                            <%# Eval("Subject").ToString().Replace(",", "<br/>")%>
                        </div>
                    </AppointmentTemplate>                   
                </telerik:RadScheduler>

aspx.cs

 if (objMyCalendarList != null)
            {
                radschMyCalendar.DataSource = objMyCalendarList;
                objMyCalendarList = objMyCalendarList.FindAll(delegate(MyActivityBE obj) { return obj.StartDateTime < obj.DueDateTime; });
                radschMyCalendar.DataBind();
            }
            else
            {
                radschMyCalendar.DataSource = null;
                radschMyCalendar.DataBind();
            }    


protected void radschMyCalendar_AppointmentDataBound(object sender, SchedulerEventArgs e)
        {
            e.Appointment.ToolTip = e.Appointment.Description;

            RadScheduler radschMyCalendar = (RadScheduler)sender;
         
            if( e.Appointment.Subject == Convert.ToString((int)EventType.Task))
            {
                e.Appointment.CssClass = "rsCategoryYellow";
            }
            else if (e.Appointment.Subject == Convert.ToString((int)EventType.TroubleTicket))
            {
                e.Appointment.CssClass = "rsCategoryRed";
            }
            else 
            {
                e.Appointment.CssClass = "rsCategoryGreen";
            }           

            e.Appointment.ToolTip = e.Appointment.Description;
            
        }


---
I have also attached some images..
So anyone can tell me that how can i able to get this functionality..

Thanx in advance.

1 Answer, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 01 Dec 2010, 04:35 PM
Hello Brijesh,

You can use custom attributes as shown in this demo. In your case you will have to set CustomAttributeNames="TypeId" and you can access or set the value from code behind with e.Appointment.Attributes["TypeId"].


Greetings,
Peter
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Scheduler
Asked by
Brijesh
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or