C# 如何将数据从aspx页面返回到RTF字段?
我正在自定义功能区工具栏并向其添加一个按钮。每当我单击该按钮时,它将打开一个aspx页面,允许作者选择一些数据,这些数据将附加到 现有RTF字段内容 我们的要求是返回数据作为链接,即锚元素,每当作者点击链接弹出页面必须打开,并允许作者选择其他选项;单击“提交”按钮后,新值必须替换为旧值 挑战是: 当前弹出页面由javascript打开,javascript是显示aspx页面的入口点。作者选择数据并提交,这个javascript返回值并附加到RTF字段。 现在,当弹出页面作为独立页面打开时,如何从中返回数据 如能早日答复,将不胜感激C# 如何将数据从aspx页面返回到RTF字段?,c#,asp.net,tridion,C#,Asp.net,Tridion,我正在自定义功能区工具栏并向其添加一个按钮。每当我单击该按钮时,它将打开一个aspx页面,允许作者选择一些数据,这些数据将附加到 现有RTF字段内容 我们的要求是返回数据作为链接,即锚元素,每当作者点击链接弹出页面必须打开,并允许作者选择其他选项;单击“提交”按钮后,新值必须替换为旧值 挑战是: 当前弹出页面由javascript打开,javascript是显示aspx页面的入口点。作者选择数据并提交,这个javascript返回值并附加到RTF字段。 现在,当弹出页面作为独立页面打开时,如何从
提前感谢。如果只是将内容添加到RTF字段,那么使用自定义URL进行添加不是会少很多工作吗 自定义URL是可以在架构字段上设置的链接,该字段将作为该字段标题上的链接显示在组件中。这将打开一个带有指定URL的弹出窗口,从那里您可以直接返回到允许添加或替换现有内容的字段 有关此主题的文档可在上找到 用于覆盖或追加文本字段内容的自定义URL HTML页面示例如下所示:
<html>
<head>
<title>Custom URL example</title>
<style>
body {
background:#fafafa;
font-family:arial,helvetica,sans-serif;
font-size:12px;
line-height:1.5em;
}
a {
color:#000;
font-weight:bold;
text-decoration:none;
}
a:hover {
color:#666;
}
</style>
<script type="text/javascript" language="javascript" src="/WebUI/Core/Controls/Popup/PopupInit.js"></script>
<script language="JavaScript">
function overwrite(value) {
var fields = window.dialogArguments.getFields();
if (fields && fields.length > 0) {
if (fields[0].getValues() != null && fields[0].getValues()[0] != null && fields[0].getValues()[0].length > 0) {
if (!confirm('This will overwrite the existing content of the field. Continue?')) {
return;
}
}
fields[0].setValues([value]);
window.close();
}
}
function append(value) {
var fields = window.dialogArguments.getFields();
if (fields && fields.length > 0) {
var current = '';
if (fields[0].getValues() != null && fields[0].getValues()[0] != null && fields[0].getValues()[0].length > 0) {
current = fields[0].getValues()[0];
}
fields[0].setValues([current + value]);
window.close();
}
}
</script>
</head>
<body>
<h1>Make a choise</h1>
<p><a href="javascript:overwrite(' - dummy content - ')">overwrite current value</a></p>
<p><a href="javascript:append(' - dummy content - ')">append to current value</a></p>
</body>
</html>
这是一个HTML页面,您应该将其放在..\Tridion\web文件夹的某个位置。我通常会在其中创建一个CustomURL子目录,以便您可以像:/CustomURL/example.HTML那样引用它。谢谢您的回复。您能解释一下如何使用自定义URL替换内容吗?添加了一个带有附加和覆盖选项的自定义URL html页面示例。