惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
News | PayPal Newsroom
Security Archives - TechRepublic
Security Archives - TechRepublic
Hacker News: Ask HN
Hacker News: Ask HN
H
Hacker News: Front Page
Apple Machine Learning Research
Apple Machine Learning Research
TaoSecurity Blog
TaoSecurity Blog
Help Net Security
Help Net Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
V
V2EX
Hugging Face - Blog
Hugging Face - Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
人人都是产品经理
人人都是产品经理
博客园 - 三生石上(FineUI控件)
Security Latest
Security Latest
Cloudbric
Cloudbric
WordPress大学
WordPress大学
S
SegmentFault 最新的问题
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Know Your Adversary
Know Your Adversary
A
Arctic Wolf
L
LangChain Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
The GitHub Blog
The GitHub Blog
P
Proofpoint News Feed
W
WeLiveSecurity
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
M
MIT News - Artificial intelligence
Google DeepMind News
Google DeepMind News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The Cloudflare Blog
小众软件
小众软件
NISL@THU
NISL@THU
云风的 BLOG
云风的 BLOG
P
Privacy & Cybersecurity Law Blog
S
Security @ Cisco Blogs
博客园 - 【当耐特】
I
InfoQ
Vercel News
Vercel News
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
P
Proofpoint News Feed
O
OpenAI News
Google DeepMind News
Google DeepMind News
N
News and Events Feed by Topic
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
K
Kaspersky official blog
T
Threat Research - Cisco Blogs
量子位
宝玉的分享
宝玉的分享

博客园 - 枫崖

操作系统引导 win7 安装arcgis后出现问题解决方案 VS2010 MSDN VIM 入门(转载) Visual Studio 2010 添加vim支持 删除svn版本信息 - 枫崖 - 博客园 ArcGIS Server中创建ao对象的CLSID如何获得 有关IHttpModule与页面的执行顺序 使用python查询中文汉字的Unicode C++中动态链接库的一些概念及入门(2) C++中动态链接库的一些概念及入门(1) Ubuntu 系统下终端快捷键设置 配置MapServer出现的一些问题及解决办法 yyyy-MM-dd日期正则表达式 未能加载文件或程序集“***”或它的某一个依赖项。拒绝访问。 mssql中sp_executesql和Exexute Win7 打开或关闭Windows功能 窗口空白 解决方案(转载) SQL Server 2008除去更新表失败的提示框 arcgis server 中使用iframepa包含地图页面 - 枫崖
对于将javascript嵌入到程序集中
枫崖 · 2009-11-11 · via 博客园 - 枫崖

使用asp.net ajax来扩展框架,将javascript嵌入到程序集中可以很方便的部署自定义的控件,下面是嵌入时需要做的步骤

这里以MSDN中的向Web 服务器控件添加 ASP.NET AJAX 客户端功能为例,自定义控件需要实现IScriptControl接口,其中有2个方法GetScriptDescriptors()和GetScriptReferences(),这里GetScriptReferences()方法要注意了,其中就是返回js脚本引用,其实这里添加和引用和在ScriptManager中使用如下方式添加引用是一回事,

<asp:ScriptManager runat="server" id="sm">
        <Scripts>
            <asp:ScriptReference Assembly="Samples" Name="Samples.SampleTextBox.js" />
        </Scripts>
</asp:ScriptManager>

看到这个你也就应该知道在GetScriptReferences()方法中的实现了和属性的设置了

ScriptReference reference = new ScriptReference();
            reference.Assembly = "Samples";                       
            reference.Name = "Samples.SampleTextBox.js";
            return new ScriptReference[] { reference };

一模一样,这是在ScriptManager是通过标签的方式声明对脚本的引用,而后者是在自定义实现服务器控件中添加对脚本的引用,这里我说明一下,Assembly的属性对应的程序集的名称,reference.Name遵循的是[程序集命名空间].[JavaScript 文件名].js命名规定,

然后再到assembly.cs中添加如下这行代码

[assembly: WebResource("Samples.SampleTextBox.js", "application/x-javascript")]

编译生成dll,搞定!!!