Sharepoint学习笔记—习题系列--70-573习题解析 -(Q48-Q50)
Question 48
You create a user control named MySearchBox.ascx.
You plan to change the native search control in SharePoint to MySearchBox.ascx. You implement a Feature that contains the following code segment.
<Control Id="SmallSearchInputBox"
Sequence="100"
ControlSrc="~/_controltemplates/MySearchBox/MySearchBox.ascx">
</Control>
You discover that the MySearchBox.ascx control fails to appear. You need to ensure that the MySearchBox.ascx control appears.
What should you do?
A. Add the ControlClass attribute.
B. Add the ControlAssembly attribute.
C. Modify the Sequence attribute value.
D. Remove the ControlSrc attribute value.
解析:
本题仍然是关于Delegate Control的问题。主要问题如何解决你所开发的Delegate Control不能真正替换目标控件的问题。
所以,首先我们就要把注意力集中到Delegate Control上,其次,分析Control的相关属性。
一个Delegate Control元素的结构如下:
<Control
ControlAssembly = "Text"
ControlClass = "Text"
ControlSrc = "Text"
Id = "Text"
Sequence = "Integer">
</Control>
其相关属性的作用如下:
ControlAssembly:可选属性,类型为 Text。指定控件的程序集的强名称。
ControlClass:可选属性,类型为 Text。指定控件的类的完全限定名。
ControlSrc:可选属性:为 Text。指定用作控件源的 .ascx 文件的相对 URL。
Id:可选属性,类型为 Text。指定控件的 ID。
Sequence:可选属性,类型为 Integer。指定控件的序列号,此序列号确定是否将控件添加到页的控件树中。具有最小序列号的控件将添加到树中。
在运行时,Delegate Control 控件接受在服务器场、Web 应用程序、网站集和网站级别上声明的控件元素的联合。通过 DelegateControl 将具有最低序列号的控件添加到控件树中。对于序列号相同的情况,控件顺序是任意的。DelegateControl 的序列号可用于集成 SharePoint Foundation 中的门户搜索控件。默认搜索控件的序列号为 100,而在序列号为 50(举例来说)的网站集级别可以激活门户搜索控件。这样,SharePoint Foundation 将在调用搜索控件的所有位置用门户搜索控件替换默认搜索控件。
从上面的描述就可以明显的看出,如果我们赋予DelegateControl不恰当的Sequence值,则此控件就会被具有最低序列号的另一对应控件所击败,从而达到你想要的结果。所以选项C就是我们想要的。
至于其它选项:
A. Add the ControlClass attribute. 用于指定控件的类的完全限定名,对是否正确Render这个控件没有任何关系,所以排除。
B. Add the ControlAssembly attribute. 指定控件的程序集的强名称,也与是否正确显示出此控件没有关系。
D. Remove the ControlSrc attribute value. 此属性用于指定用作控件源的 .ascx 文件的相对 URL。如果移除此属性,则直接会报错,而不是显示不出此控件。
所以本题目正确选项应该是C
参考 :
http://msdn.microsoft.com/zh-cn/library/ms470880(v=office.14).aspx
http://msdn.microsoft.com/en-us/library/ms469179.aspx
http://www.cnblogs.com/wsdj-ITtech/archive/2011/11/26/2263041.html
Question 49
You have several SharePoint sites.
You plan to load a custom script in all pages of the sites. You need to ensure that you can activate or deactivate the script at the site level.
What should you do?
A. Create a site definition and modify the CustomJSUrl attribute in the Onet.xml file.
B. Create a site definition and modify the <system.web> element in the web.config file.
C. Create a user control that contains the script. Create a Feature that overrides the ControlArea delegate control.
D. Create a user control that contains the script. Create a Feature that overrides the AdditionalPageHead delegate control.
解析:
本题的意图是加载一段用户的Script代码到某个网站的所有页面,并可以在网站级别实现启用/停止此Script代码的功能。
首先分析选项A.B都是要你创建一个Site Definition,这显然是不对的。因为Site Definition是用来创建一个新的Site的。而本题告诉你,你已经有了好几个Sharepoint Sites了,而你要实现的相关功能都是基于这些已经存在的Sites来实现的。从这个层面上,选项A.B可以直接排除。
选项A 中需要说明的是CustomJSUrl, 它用于指定位于 \\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS 目录中的自定义 JavaScript 文件,此文件包含从网站定义(Site Definition)创建的网站中执行的脚本。所以这也是一种在Site中引入Script的途径,只不过此途径不适合本题的情况。
再来看选项C.D, 显然它们都和User Control相关,唯一不同的就是override的Delegate Control不同。因此分析它们的Delegate Control。
选项C . ControlArea 貌似不属于MasterPage中的Delegate Control,如果有谁知道,可以告诉我一声。
选项D .AdditionalPageHead 它可以被用来实现本题需要的效果。此类似的功能也在我的另一篇博文中实现,请参考:http://www.cnblogs.com/wsdj-ITtech/archive/2012/01/14/2264851.html
所以本题目正确选项应该是D
参考 :
http://msdn.microsoft.com/en-us/library/ms470880.aspx
http://singchan.com/2010/02/23/branding-sharepoint-2010-collaboration-sites-part-3-in-a-series/
http://www.cnblogs.com/wsdj-ITtech/archive/2012/01/14/2264851.html
Question 50
You have a SharePoint site that uses a master page named Master1.master.
You create a custom user control named MySearch.ascx.
You need to change the default search box to MySearch.ascx.
What should you do?
A. Modify the SmallSearchInputBox control tag in the master page, and then configure the ControlId property.
B. Modify the SmallSearchInputBox control tag in the master page, and then configure the ControlSrc property.
C. Create a Web Part that uses MySearch.ascx. In the master page, add a control tag that references the .webpart file.
D. Create a Visual Web Part that uses MySearch.ascx. In the master page, add a control tag that references the .webpart file.
解析:
本题仍然是Delegate Control实现问题。仍可以参考我的博文: http://www.cnblogs.com/wsdj-ITtech/archive/2011/11/26/2263041.html
摘录其中的一部分如下:
让我们来看一看delegate control 的XML schema
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Control Id="SmallSearchInputBox" Sequence="100" ControlSrc="/templates/mysearchcontrol.ascx"/>
</Elements>
从上面的schema,我们可以看出,delegate control的重要属性包括 Control Id, Sequence 和 ControlSrc.
Control Id 是我们用来识别Delegate control的
Sequence number 是我们用来定位Delegate control的等级的,它的值越小则等级越高。
ControlSrc 则用来指明Delegate Control的控件资源的位置的。
因为本题要求:You need to change the default search box to MySearch.ascx,即:要替代原有的default search box。 所以只能使用Delegate Control来实现。
而选项C.D 就是利用在CatalogZone中使用ImportCatalogPart控件来导入用户定义的Web Part。
所以本题目正确选项应该是B
参考:
http://msdn.microsoft.com/en-us/library/ms463169.aspx
http://msdn.microsoft.com/zh-cn/library/system.web.ui.webcontrols.webparts.catalogzone(v=vs.80).aspx
Sharepoint学习笔记—习题系列--70-573习题解析 -(Q48-Q50)的更多相关文章
- Sharepoint学习笔记—ECM系列—文档列表的Metedata Navigation与Key Filter功能的实现
如果一个文档列表中存放了成百上千的文档,想要快速的找到你想要的还真不是件容易的事,Sharepoint提供了Metedata Navigation与Key Filter功能可以帮助我们快速的过滤和定位 ...
- Sharepoint学习笔记—ECM系列--文档集(Document Set)的实现
文档集是 SharePoint Server 2010 中的一项新功能,它使组织能够管理单个可交付文档或工作产品(可包含多个文档或文件).文档集是特殊类型的文件夹,它合并了唯一的文档集属性以及文件夹和 ...
- Sharepoint学习笔记—习题系列--70-576习题解析 --索引目录
Sharepoint学习笔记—习题系列--70-576习题解析 为便于查阅,这里整理并列出了70-576习题解析系列的所有问题,有些内容可能会在以后更新. 需要事先申明的是: 1. ...
- Sharepoint学习笔记—习题系列--70-573习题解析 --索引目录
Sharepoint学习笔记—习题系列--70-573习题解析 为便于查阅,这里整理并列出了我前面播客中的关于70-573习题解析系列的所有问题,有些内容可能会在以后更新, ...
- Deep Learning(深度学习)学习笔记整理系列之(五)
Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...
- Deep Learning(深度学习)学习笔记整理系列之(八)
Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...
- Deep Learning(深度学习)学习笔记整理系列之(七)
Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...
- Deep Learning(深度学习)学习笔记整理系列之(六)
Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...
- Deep Learning(深度学习)学习笔记整理系列之(四)
Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...
- Deep Learning(深度学习)学习笔记整理系列之(三)
Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...
随机推荐
- SNF开发平台WinForm之一-开发-单表表格编辑管理页面-SNF快速开发平台3.3-Spring.Net.Framework
1.1运行效果: 1.2开发实现: 1.2.1 首先在数据库中创建需要开发的数据表,在代码生成器中进行配置连接数据库. 代码生成器的Config.xml文件配置如下节点: 1.2.2 ...
- Arcgis报错: Bad login user Failed to execute (CreateEnterpriseGeodatabase).
在使用工具Create Enterprise Geodatabase的时候报错Bad login user,开始怀疑为密码错误,然后反复在plsql中尝试发现并没有错误,很疑惑,然后去官网查询: Er ...
- 微信公众号开发第二课 百度BAE搭建和数据库使用
上一节主要是一些准备知识,本课还是准备知识,开发微信也可以不使用数据库,但是要想搭建一些查询类应用,就可能使用到数据库操作,所以本节主要涉及到百度BAE上面的数据库表的创建,插入数据,修改数据,删除数 ...
- 二叉查找树(三)之 Java的实现
概要 在前面分别介绍了"二叉查找树的相关理论知识,然后给出了二叉查找树的C和C++实现版本".这一章写一写二叉查找树的Java实现版本. 目录 1. 二叉树查找树2. 二叉查找树的 ...
- 《微信小程序七日谈》- 第三天:玩转Page组件的生命周期
<微信小程序七日谈>系列文章: 第一天:人生若只如初见: 第二天:你可能要抛弃原来的响应式开发思维: 第三天:玩转Page组件的生命周期: 第四天:页面路径最多五层?导航可以这么玩 前两篇 ...
- [linux]scp指令
实例1:从远处复制文件到本地目录 $scp root@10.6.159.147:/opt/soft/demo.tar /opt/soft/ 说明: 从10.6.159.147机器上的/opt/soft ...
- Html5+css3+angularjs+jquery+webAPi 开发手机web(一)
前言 随着浏览器的发展 HTML5+CSS3 的使用也越来越广泛,一直想学这个,想学那个折腾下来几乎没学到什么东西.工作经验告诉我,要掌握一门技术,就需要在项目中去磨练, 所以我就准备开发一个手机端的 ...
- Angular系列----AngularJS入门教程00:引导程序(转载)
我们现在开始准备编写AngularJS应用——phonecat.这一步骤(步骤0),您将会熟悉重要的源代码文件,学习启动包含AngularJS种子项目的开发环境,并在浏览器端运行应用. 进入angul ...
- 理解SQL Server的查询内存授予(译)
此文描述查询内存授予(query memory grant)在SQL Server上是如何工作的,适用于SQL 2005 到2008. 查询内存授予(下文缩写为QMG)是用于存储当数据进行排序和连接时 ...
- IE11之F12 Developer Tools--调试器(Debugger)
使用调试器工具在代码运行时对其导航.设置监视点和断点,查看调用堆栈,以及提高编译/精简JavaScript的可读性. 调试器可以帮助你了解为何你的代码片段会出现未按照预期方式运行.未在预期时间运行及在 ...