问题描述
我加载的.aspx和.ascx文件为的StreamReader
。
I am loading .aspx and .ascx files as StreamReader
.
我希望每个文件注册它的JavaScript和样式表依赖于像&LT一些声明;%@ ClientDependency路径=〜/脚本/ jQuery的-1.4.1.min.js%GT;
。
I want each file to register it's javascript and stylesheet dependencies in some declaration like a <%@ ClientDependency path="~/Scripts/jquery-1.4.1.min.js" %>
.
有没有做这样的事情的现有约定?我不需要一个实现,但我不希望创建一个新的语法,如果已经有一个办法做到这一点。
Is there an existing convention for doing such a thing? I don't need an implementation, but I don't want to create a new syntax if there is already a way to do it.
此外,什么是自定义的&LT的指导方针;在ASP.NET%@
块
Also, what are the guidelines for custom <%@
blocks in ASP.NET?
此外,请重新生成代码,如果你能想到的一个更恰当的描述了这个问题。
Also, please retag this question if you can think of a more appropriate description.
推荐答案
有是用于注册客户没有现成的约定包括一个指令。我的解决办法是,而不是创建一个自定义服务器控件,并使用现有的的TemplateParser
的功能,以获得包括数据(最终是preferable将文件加载作为流和解析它自己)。
There is no existing convention for registering client includes with a directive. My solution was to create a custom server control instead and use the existing TemplateParser
functionality to get the include data (which ended up being preferable to loading the file as a stream and parsing it myself).
这篇关于ASP.NET指令公约声明客户端包含的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!