Sunday, March 11, 2012

CalendarExtender inside UpdatePanel CSS resource problem

I've openedwork item 7648 to track this and added some details about the problem there.

Hi,

I ended up using the following inside the Page_Load method:

// when inside an UpdatePanel the WebResource CSS file for CalendarExtender is not loaded - need to force it to loadstring url = Page.ClientScript.GetWebResourceUrl(typeof(ClientCssResourceAttribute),"AjaxControlToolkit.Calendar.Calendar.css");
// Define an HtmlLink control.HtmlLink myHtmlLink =new HtmlLink();
myHtmlLink.Href = url;
myHtmlLink.Attributes.Add("rel","stylesheet");
myHtmlLink.Attributes.Add("type","text/css");
// Add the HtmlLink to the Head section of the page.Page.Header.Controls.Add(myHtmlLink);
Assuming the client is caching the CSS file properly this shouldn't have too much of an impact, but it does mean you'd have to do this on every page with a CalendarExtender.
Thanks this has been bugging me for a while.
Thankyou!!!!!!.... you've just saved me from hours of messing around.Big Smile

No comments:

Post a Comment