problem to see image in the calendar

5 posts, 0 answers
  1. udi
    udi avatar
    8 posts
    Member since:
    Nov 2007

    Posted 22 May 2008 Link to this post

    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).

  2. Dimo
    Admin
    Dimo avatar
    8472 posts

    Posted 22 May 2008 Link to this post

    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
  3. udi
    udi avatar
    8 posts
    Member since:
    Nov 2007

    Posted 22 May 2008 Link to this post

    hi,

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

    thanks.
  4. Daniel
    Admin
    Daniel avatar
    4949 posts

    Posted 23 May 2008 Link to this post

    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
  5. udi
    udi avatar
    8 posts
    Member since:
    Nov 2007

    Posted 23 May 2008 Link to this post

    thanks a lot it's work!!!
Back to Top