通过 CMS 处理用户控件中的内容?
Composite C1 中是否有一种方法可以通过后端管理页面上使用的 ASP.NET 用户控件中的静态文本?
Is there a way in Composite C1 to manage static text in ASP.NET usercontrols used on pages through the backend?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在这个答案中,我假设您希望通过可视化编辑器(html 文档)维护“静态文本”,允许您的用户执行标题、样式、粗体等。如果您只是想要一个简单的大文本框,那么可以简化。
首先在数据透视图上创建一个新的全局数据类型 - 为其命名(在下面的代码示例中,我将其命名为 Maw.Content)并为其提供以下两个字段:
保存新数据类型后,您可以向其中添加“记录” - 并指定字段键和相关内容。
这应该负责管理内容 - 您获得的 UI 应该非常用户友好。您可以右键单击树中的数据类型,然后使用命令“在内容透视图中显示”,这将使您的数据类型显示在内容 |网站项目。这样您的用户就根本不必使用数据透视图。
如果您不需要用户添加/删除项目,请考虑将用户对数据文件夹的访问权限限制为“编辑”。右键单击包含数据项的文件夹并选择“编辑权限”。
从命名字段输出 XHTML
在您的用户控件中,您可以获取与特定 FieldKey 相关的 html,如下所示:
In this answer I'm asuming you would like the "static text" to be maintained via a Visual Editor (html document), allowing your users to do heading, styling, bold etc. If you are just going for a simple large textbox this can be simplified.
Start by creating a new Global Data Type on the Data perspective - name it (in the code sample below, I named it Maw.Content) and give it these two fields:
Once you save your new data type you can add 'records' to it - and specify a field key and related content.
This should take care of managing the content - the UI you get should be pretty user friendly. You can right click the data type in the tree and use the command "Show in Content perspective" which will make your data type show up on Content | Website Items. This way your users do not have to use the Data perspective at all.
Consider limiting user access to the data folder to just "Edit", in case you do not need users to add/delete items. Right click the folder containing data items and slect 'Edit Permissions'.
Outputting the XHTML from a named field
In your user controls you can grab the html related to s specific FieldKey like this: