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

Style by hidden resource/attribute

4 Answers 56 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Ryan Baxter
Top achievements
Rank 1
Ryan Baxter asked on 30 Nov 2012, 08:26 PM
Is there a way for me to style by a hidden resource/attribute?  Every time an event is written I also log which user enters it via a insert parameter that is assigned via page_load so the user never sees this field and its not part of the form.  I would assume I need to add it as a resource or attribute and then set the visibility to false and set the value to something if I want to make it work?

4 Answers, 1 is accepted

Sort by
0
Ryan Baxter
Top achievements
Rank 1
answered on 03 Dec 2012, 02:39 PM
I was able to hide my attribute once I figured out I need to add "Attr" to the front of the field I set in the "CustomAttributeNames" field.  But now how would I go about looping thru all values and setting a color.  I dont see a "Get" function like there is for the resources ...

EX:
Protected Sub ResourceStyles()
        For Each res As Resource In RadScheduler1.Resources.GetResourcesByType("User")
            Dim resMapping As New ResourceStyleMapping()
            resMapping.Key = res.Key.ToString()
            resMapping.BackColor = RandomRGBColor()
 
            RadScheduler1.ResourceStyles.Add(resMapping)
        Next
    End Sub

0
Plamen
Telerik team
answered on 04 Dec 2012, 11:35 AM
Hi,

 
The easiest way to achieve it is by using AppointmentDataBound server event as you mentioned you did in the other forum thread.

Kind regards,
Plamen
the Telerik team
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 their blog feed now.
0
Ryan Baxter
Top achievements
Rank 1
answered on 04 Dec 2012, 01:09 PM
How do I get all the distinct values or do I need to loop thru all the appointments first?  The attributes dont have all the options that the resources do.
0
Plamen
Telerik team
answered on 07 Dec 2012, 10:12 AM
Hi,

 
You don't have to loop all appointments because AppointmentDataBound is throwing for every one of them. Here is a sample code that will change the appointment color if its attribute is set with particular value:

protected void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e)
   {
       if (e.Appointment.Attributes["Annotations"]=="red")
       {
           e.Appointment.BackColor = System.Drawing.Color.Red;
       }
       
       
   }

Hope this will be helpful.
Kind regards,
Plamen
the Telerik team
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 their blog feed now.
Tags
Scheduler
Asked by
Ryan Baxter
Top achievements
Rank 1
Answers by
Ryan Baxter
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or