只有内容控件直接允许包含内容控件的内容页 [英] Only Content controls are allowed directly in a content page that contains Content controls

查看:218
本文介绍了只有内容控件直接允许包含内容控件的内容页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想一个内容占位符加入到母版页,但得到上述错误。
母版页继承自己从另一个母版页和许多孩子大师的ContentPlaceHolders都包裹在其中注入从继承网页内容到父主的占位内容的标签。
不过,我想孩子师傅从基地主偏离了一点,但有其自身的ContentPlaceHolder无关父主。然而,它似乎不喜欢有以下行:

 < ASP:的ContentPlaceHolder ID =chpBanner=服务器/>


解决方案

这是不可能的。它甚至没有逻辑意义。结果
如果放在一个独立的ContentPlaceHolder将如何父母版页知道在哪里把它的内容是什么?

这将如何生成控件树,如果没有父母的控件重视?

您将在家长选择的ContentPlaceHolder将其添加到。结果
如果你这样做是对定位的目的,你可以使用CSS来定位的内容这个div徘徊无论你想要呈现的页面上。

I'm trying to add a content place holder into a master page but getting the above error. The master page inherits itself from another master page and many of the ContentPlaceHolders of the child master are wrapped in Content tags which inject the content from the inheriting page into the place holders of the parent master. However, I want the child master to deviate a little from the base master, but having its own ContentPlaceHolder unrelated to the parent master. Yet it seems to not like having the following line:

<asp:ContentPlaceHolder ID="chpBanner" runat="server" />

解决方案

That is not possible. It does not even make logical sense.
If you placed an independent ContentPlaceHolder how would the parent master page know where to put the contents of it?

How would it build the control tree, if there was no parent to attach the controls to?

You will have to select a ContentPlaceHolder in the parent to add it to.
If you are doing this for positioning purposes, you can use CSS to position the contents of this div whereever you want on the rendered page.

这篇关于只有内容控件直接允许包含内容控件的内容页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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