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

[Solved] Icones

3 Answers 116 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Jean-Yves
Top achievements
Rank 1
Jean-Yves asked on 06 Jul 2009, 08:34 PM
Hi,

I put an AppTemplate on my RadScheduler.
here is my code : 
public class AppTemplate : ITemplate
        {
            public void InstantiateIn(Control container)
            {
                var subject = new Literal();
                subject.DataBinding += subject_DataBinding;
                container.Controls.Add(subject);
            }

            private static void subject_DataBinding(object sender, EventArgs e)
            {
                var subject = (Literal)sender;
                var aptCont = (SchedulerAppointmentContainer)subject.Parent;
                Appointment app = aptCont.Appointment;

                var myId = app.ID.ToString().Split('_');
                int idCalendar = Convert.ToInt32(myId[0]);

                var calendar = new BLLCalendar().getCalendar(idCalendar);

                String numAffaire;
                try
                {
                    numAffaire = calendar.Affaire.Num;
                }
                catch
                {
                    //var user = new BLLUser().getUser(calendar.IdUser);
                    //numAffaire = user.NumeroService;
                    numAffaire = calendar.CodeHeure1.Libelle;
                }

                if (calendar.IsValider)
                {
                    app.ForeColor = Color.Green;
                }
                if (calendar.IsSaisie)
                {
                    app.ForeColor = Color.Red;
                    app.AllowEdit = false;
                    app.AllowDelete = false;
                }


                subject.Text = String.Format("{0} - {1}", numAffaire, calendar.Temps);
                app.ToolTip = calendar.Commentaire;

                app.CssClass = SchedulerCSS.getCSSHeures(calendar.CodeHeure);
            }
        }


With this I have questions : 
- Is it possible to add the recurrence Icon or other Icons on appointment ?
- Why with some SchedulerCSS the proprety app.ForeColor = Color.Red; doesn't work ?

thank you.

PS : Q2 is great !!!! 

3 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 09 Jul 2009, 02:20 PM
Hello Jean-Yves,

Please find attached a sample project. It shows you how to display the recurrence icon and works as expected. I could not reproduce the second problem.

Regards,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jean-Yves
Top achievements
Rank 1
answered on 10 Jul 2009, 05:57 PM
Great !!!!!

Thank you very much.
Now I can put all icons I want.

For the color, in fact you have 'DarkCSS' like rsCategoryDarkGreen and 'normalCSS' like rsCategoryOrange
With out special code, le text is black for 'normalCSS' and white for 'DarkCSS'

But when I put this code for all appointment : 
private static void subject_DataBinding(object sender, EventArgs e) 
     var subject = (Literal)sender; 
     var aptCont = (SchedulerAppointmentContainer)subject.Parent; 
     Var app = aptCont.Appointment; 
 
     app.ForeColor = Color.Red; 

My 'normalCSS' text is red but the 'DarkCSS' text is still white.



I have a new question with scheduler, can we add new propriety ?
For example, here I can get the ID of the appointment (with : app.ID)
Can I add a propriety color ? or some thing like this ? 
0
Veselin Vasilev
Telerik team
answered on 15 Jul 2009, 12:26 PM
Hi Jean-Yves,

Maybe the DarkCSS has an !important clause and that overrides the color that you set at runtime?
I can only guess in this case.



Kind regards,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Scheduler
Asked by
Jean-Yves
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Jean-Yves
Top achievements
Rank 1
Share this question
or