简体   繁体   English

vs 2008 Express无法创建嵌入式资源

[英]Failed to create embedded resource in vs 2008 express

I have extended asp gridview for giving column filter and I wish to embedded the js file along with this control. 我已经扩展了asp gridview以提供列过滤器,并且希望将js文件与该控件一起嵌入。

For this i have done 为此,我做了

  1. Added a quicksearch.js under js folder 在js文件夹下添加了quicksearch.js
  2. Marked the file as Embedded Resource 将文件标记为Embedded Resource
  3. Added the entry in AssemblyInfo.cs 在AssemblyInfo.cs中添加了条目
    [assembly: System.Web.UI.WebResource("ControlLibrary.js.quicksearch.js", "application/x-javascript", PerformSubstitution = true)] [程序集:System.Web.UI.WebResource(“ ControlLibrary.js.quicksearch.js”,“ application / x-javascript”,PerformSubstitution = true)]
  4. Added the fpllowing code in OnInit() of grid 在网格的OnInit()中添加了以下代码

      base.OnInit(e); Type t = this.GetType().BaseType; ScriptManager.RegisterClientScriptResource(this, t, "ControlLibrary.js.quicksearch.js"); 

But the RegisterClientScriptResourceis giving me an exception 但是RegisterClientScriptResource给了我一个例外

Web resource ControlLibrary.js.quicksearch.js' was not found.

I tried the above in vs 2008 express edition. 我在vs 2008 Express Edition中尝试了上述方法。

Why i cannot embedded .js file in dll. 为什么我无法在dll中嵌入.js文件。 Any help will be appreciated 任何帮助将不胜感激

Ok I sorted it out 好,我整理了一下

Instead of type t we have to give the assembly where the embedded script is found 而不是类型t我们必须提供找到嵌入式脚本的程序集
Following code solved my issue 以下代码解决了我的问题

Type t = typeof(ControlLibrary.HWGridView);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Silverlight和VS 2005或VS 2008 Express Edition - Silverlight and VS 2005 or VS 2008 Express Edition 使用VS 2010使用JQuery(CDN)作为嵌入式资源创建ASP.NET复合自定义服务器控件吗? - With VS 2010 create ASP.NET composite custom server control with JQuery (CDN) as embedded resource? VS 2008,通过资源文件夹部署应用程序 - VS 2008, deploying application with resource folder VS 2008不了解.resource文件 - VS 2008 does not understand .resource files 资源文件(.resx)与反射以访问嵌入式资源 - Resource file (.resx) vs reflection to access an embedded resource 嵌入式资源vs内容vs单独的文件夹xml文件 - embedded resource vs content vs separate folder xml files 在VS2008 ASP.NET项目中使用嵌入式文件 - Using embedded file in VS2008 ASP.NET Project SQL Server 2008 R2 Express:用户登录失败 - SQL Server 2008 R2 Express : Login failed for user 使用VS 2008 Express时打开控制台/命令窗口 - Open a Console/Command Window when using VS 2008 Express 如何在VS 2008中或使用Coderush Express自动生成方法存根? - How to generate method stubs automatically in VS 2008 or using Coderush Express?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM