AjaxControlToolkit没有通过WebResource.axd加载css导致ajaxToolkit:TabPanel无法显示正确的样式

https://stackoverflow.com/questions/3318092/what-is-webresource-axd

WebResource.axd provides access to embedded resources within a project. It's a handler that enables control and page developers to download resources that are embedded in an assembly to the end user.

You include WebResources in your AssemblyInfo:

[assembly: System.Web.UI.WebResource("Project.Styles.Main.css", "text/css")]

Then you can get an include path for your Page using the following code:

string includeLocation = Page.ClientScript.GetWebResourceUrl(this.GetType(),    
    "Project.Styles.Main.css");

Then to add the above file (which is a CSS file in this case):

LiteralControl include = new LiteralControl(
    String.Format(includeTemplate, includeLocation));

((System.Web.UI.HtmlControls.HtmlHead)Page.Header).Controls.Add(include);

Then you'll end up seeing references within your page source such as the following:

/WebResource.axd?d=PhPk80h_UWEcbheb-NHNP5WshV_47UOpWqAOl1_li
    UFfN4cNofL74cFlQ1fvpFSf0&t=632573240669964903

 

https://github.com/DevExpress/AjaxControlToolkit/wiki/How-to-use-bundling-and-CDN

To disable bundling:

  • remove ScriptReference from ScriptManager
  • remove the Style.Render expression from the element
  • in the “ajaxControlToolkit” config section (Web.config), set the “renderStyleLinks” attribute to “true”, and the “useStaticResources” attribute to “false”

只需要将renderStyleLinks设置为true就可以,另外一个attribute默认就是false

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(404)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2017-10-30 RSA in .net and dotnet core
2017-10-30 单点登录
2015-10-30 git svn rebase出现了checksum mismatch的错误
2014-10-30 8.2.2继承 第8章 面向对象编程简介
2014-10-30 单例模式和静态类的区别
点击右上角即可分享
微信分享提示