无法在vs 2008 express中创建嵌入式资源

时间:2015-09-08 08:20:37

标签: c# asp.net gridview visual-studio-2008 webresource.axd

我已经扩展了asp gridview以提供列过滤器,我希望将js文件与此控件一起嵌入。

为此我已经完成了

  1. 在js文件夹
  2. 下添加了quicksearch.js
  3. 将文件标记为Embedded Resource
  4. 在AssemblyInfo.cs中添加了条目         [assembly:System.Web.UI.WebResource(" ControlLibrary.js.quicksearch.js",        "应用程序/ x-的javascript&#34 ;,        PerformSubstitution = true)]
  5. 在网格

    的OnInit()中添加了fpllowing代码
       base.OnInit(e);
       Type t = this.GetType().BaseType;
       ScriptManager.RegisterClientScriptResource(this, t, "ControlLibrary.js.quicksearch.js");
    
  6. 但是RegisterClientScriptResource给了我一个异常

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

    我在vs 2008快车版中尝试了上述内容。

    为什么我不能在dll中嵌入.js文件。任何帮助将不胜感激

1 个答案:

答案 0 :(得分:0)

好的我把它整理出来了

而不是类型t,我们必须给出发现嵌入脚本的程序集 以下代码解决了我的问题

Type t = typeof(ControlLibrary.HWGridView);