在母版页使用ScriptCombining通过一个ScriptManager [英] Using ScriptCombining through a ScriptManager on a Master Page

查看:143
本文介绍了在母版页使用ScriptCombining通过一个ScriptManager的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ASP.NET 3.5 SP1增加了一个伟大的新ScriptCombining功能将ScriptManager的对象上展示的这个影片。但是他只演示了如何使用该功能使用ScriptManager在同一页上。我想使用此功能的网站上,其中的ScriptManager是在母版页上,但无法弄清楚如何添加我需要为每个页面编程到经理的脚本。我发现<一href="http://seejoelprogram.word$p$pss.com/2008/08/19/net-35-sp1-doesnt-provide-composite-script-registration-from-an-iscriptcontrol-out-of-the-box/"相对=nofollow>这个帖子作为一个起始点,但我没有真正得到很远。谁能给我伸出援助之手?

ASP.NET 3.5 SP1 adds a great new ScriptCombining feature to the ScriptManager object as demonstrated on this video. However he only demonstrates how to use the feature with the ScriptManager on the same page. I'd like to use this feature on a site where the scriptmanager is on the master page but can't figure out how to add the scripts I need for each page programmatically to the manager. I've found this post to use as a starting point, but I'm not really getting very far. can anyone give me a helping hand?

谢谢,丹

推荐答案

给这一个镜头:

    ScriptReference SRef = new ScriptReference();
    SRef.Path = "~/Scripts/Script.js";


    ScriptManager.GetCurrent(Page).CompositeScript.Scripts.Add(SRef);

,将得到当前的ScriptManager(即使它是一个母版页上),并添加脚本参考CompositeScript属性。

That will get the current scriptmanager (even if it is on a master page) and add a script reference to the CompositeScript properties.

这篇关于在母版页使用ScriptCombining通过一个ScriptManager的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆