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

Special Days and Skins

2 Answers 130 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Michael Stone
Top achievements
Rank 1
Michael Stone asked on 27 Apr 2008, 01:51 PM

I built a calendar where I create a link button as a day's contents using a class derived from ITemplate.

This works fine.

Some of the days in the current month have events in them so I highlight these by setting the background image like this:

LinkButton link = new LinkButton();
link.ID = day.Date.ToString("MM/dd/yyyy");
link.Text = day.Date.Day.ToString();
link.ToolTip = day.ToolTip;
// Is there an event on this day?
if (bEvent)
{
    link.Style.Add("background", "url(" + SkinImagePath + "HoverBg.gif) left top no-repeat");
}
// Build the command parameters for this link.
link.Command += new CommandEventHandler(onDayClick);
link.CommandName = "ShowDay";
link.CommandArgument = day.Date.ToShortDateString();
CalendarCellContentTemplate template = new CalendarCellContentTemplate(calendar, day.Date, link);

I believe I got the method from another posting is this forum.  The problem is with the highlighted line.  It works fine with a skin such as Web20 but it looks wrong with other skins.  I looked in the skin CSS files and saw why.  For Web20 the background image is as big as a cell and so is not repeated.  With other skins the background image is very narrow and repeated on X.  Some other skins don't even have a "HoverBG.gif".

I want to allow my users to be able to select whichever skin they like so I want to know if there's a higher-level way of doing this?  Is there some property I can set?

Note, I also use the method described in this forum to disable hover so only the event days have this appearence:

Literal js = new Literal();
js.ID = "JavaScriptLiteral";
js.Text = "<script type=\"text/javascript\">\nwindow.onload = function()\n{\nRadCalendarNamespace.RenderDay.prototype.ApplyHoverBehavior = function(){return false;};\n}\n</script>\n";
Controls.Add(js);

Thank you.

2 Answers, 1 is accepted

Sort by
0
Michael Stone
Top achievements
Rank 1
answered on 27 Apr 2008, 03:24 PM
Sorry, I just noticed this is in the wrong forum.

I'm not using the new asp.net ajax release yet.
0
Missing User
answered on 30 Apr 2008, 02:12 PM
Hi Michael,


You can modify directly the predefined skin you chose for the RadCalendar control - you can read the following link from the RadCalendar help regarding skins (if haven't already done that):

http://www.telerik.com/help/aspnet/calendar/?cldSkins.html

I hope this helps


Regards,
Plamen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Calendar
Asked by
Michael Stone
Top achievements
Rank 1
Answers by
Michael Stone
Top achievements
Rank 1
Missing User
Share this question
or