如何创建ASP服务器控件包含CSS文件 [英] how to create asp server control inlude css file
本文介绍了如何创建ASP服务器控件包含CSS文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好.我想创建一个asp.net服务器控件,我想要可执行的CSS文件.
Hi everybody. I want to create a asp.net server control, i want emable css file.
Type rsType = this.GetType();
string csslink = @"<link rel='stylesheet' type='text/css' href='" +
Page.ClientScript.GetWebResourceUrl(rsType, "Lib.Style.base.css") + "' />";
LiteralControl include = new LiteralControl(csslink);
this.Page.Header.Controls.Add(include);
但是当我建造和使用它时,我却无法正常工作.
感谢support
But when i built and use it, i dose not work.
Thanks to support
推荐答案
您好,
请看一下这些文章.
Hello,
Please have a look at these articles.
- How To Embedded StyleSheet File with Custom Control[^]
- Embedding and inlining resources in ASP.NET Web Controls[^]
谢谢您的回复.但我正在尝试,但仍然无法使用.
Thanks you for reply. But i am trying it, it still do not works.
private void RegisterCSSInclude(Control target)
{
Type rsType = this.GetType();
string csslink = @"<link rel="stylesheet" type="text/css" href="" + <br mode="hold" /> Page.ClientScript.GetWebResourceUrl(rsType, "Lib.Style.base.css") + "" />";
LiteralControl include = new LiteralControl(csslink);
this.Page.Header.Controls.Add(include);
}
这篇关于如何创建ASP服务器控件包含CSS文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文