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

problem to see image in the calendar

4 Answers 72 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
udi
Top achievements
Rank 1
udi asked on 22 May 2008, 04:15 PM

How can i insert picture to calendar (like your example in special days).
I didn't find how can i fill the content propertie with image object for DayTemplate.
Please send me a full code for server side programaticlly to see image in the calendar.

Where can i find the code behind for your aspx calendar examples (special days).

4 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 22 May 2008, 04:46 PM
Hello Udi,

Did you see the Code Viewer below the Special Days example? It shows exactly how to insert images inside a Day Template:

http://telerik.com/demos/aspnet/prometheus/Calendar/Examples/Functionality/SpecialDays/DefaultCS.aspx

(Scroll down to "Example Source Code & Description")

Let us know if you need additional information.


All the best,
Dimo
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
udi
Top achievements
Rank 1
answered on 22 May 2008, 05:11 PM
hi,

i see that but the code their is in .aspx , i need  to build that in the code behind,
that my problem.

thanks.
0
Daniel
Telerik team
answered on 23 May 2008, 11:12 AM
Hi udi,

Thanks you for contacting us.

Here is some example code:
    public class CalendarCellContentTemplate : ITemplate 
    { 
        private Control cellContent; 
 
        public void New(RadCalendar calendarInstance, DateTime cellDate, Control cellContent) 
        { 
            RadCalendarDay spec; 
            this.cellContent = cellContent; 
 
            int index = calendarInstance.SpecialDays.IndexOf(cellDate); 
            spec = calendarInstance.SpecialDays[index]; 
 
            if (spec == null
            { 
                spec = new RadCalendarDay(); 
                spec.Date = cellDate; 
                spec.TemplateID = spec.Date.ToString("yyyy/MM/dd"); 
                calendarInstance.SpecialDays.Add(spec); 
            } 
 
            DayTemplate template = new DayTemplate(); 
 
            template.ID = spec.TemplateID; 
            template.Content = this
 
            spec.Repeatable = RecurringEvents.DayInMonth; 
            calendarInstance.CalendarDayTemplates.Add(template); 
        } 
 
        public void InstantiateIn(Control container) 
        { 
            container.Controls.Add(this.cellContent); 
        } 
    } 


        protected void Page_Load(object sender, EventArgs e) 
        { 
            if (!IsPostBack) 
            { 
                CalendarCellContentTemplate ctemp = new CalendarCellContentTemplate(); 
                 
                Image img = new Image(); 
                img.ImageUrl = "images/birthday.jpg"
                ctemp.New(RadCalendar1, new DateTime(2008, 5, 23), img); 
            } 
        } 

Greetings,
Daniel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
udi
Top achievements
Rank 1
answered on 23 May 2008, 12:54 PM
thanks a lot it's work!!!
Tags
Calendar
Asked by
udi
Top achievements
Rank 1
Answers by
Dimo
Telerik team
udi
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or