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.