嵌入视图和资源 (mvc)
我已在库中嵌入了多个视图,以便我可以使用此方法在项目之间重复使用,该方法工作正常:
http://www.wynia.org/wordpress/2008/12/aspnet-mvc-plugins/
但有一个视图使用 Javascript 文件。我尝试将其标记为嵌入式资源并添加它 AssemblyInfo.cs ,然后使用引用此资源
<%= ClientScript.GetWebResourceUrl(this.GetType(), "FullPath.FileName.js")%>
这实际上是在视图
WebResource.axd?d=nUxqfqAUQLabLU54W
中显示此输出我认为这是因为我试图引用嵌入式来自嵌入资源的资源。
帮助感谢我在兜圈子..
史蒂夫
I've embedded several views in a library so that I can re-use across projects using this method which works OK:
http://www.wynia.org/wordpress/2008/12/aspnet-mvc-plugins/
But one view usings a Javascript file. I've tried marking this as an embedded resource and adding it AssemblyInfo.cs and then referencing this resource using
<%= ClientScript.GetWebResourceUrl(this.GetType(), "FullPath.FileName.js")%>
This is literally displaying this output in the view
WebResource.axd?d=nUxqfqAUQLabLU54W
I think this is because Im trying to refer to an embedded resource from an embedded resource.
Help appreciated as Im going round in circles..
Steve
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里的问题是我对 GetWebResourceUrl 的调用。我已将格式更改为下面的格式,并且工作正常:)
因此,我将调用包含在脚本标记中并更改了类型参数。
The problem here was with my call to GetWebResourceUrl. I've changed the format to that below and it works fine :)
So Ive contained the call in a script tag and changed the type parameter.