我在访问变量方面遇到了一些麻烦,在本例中为Setvariable.当我进入循环内部时,变量不存在.任何人都对此有任何见解.感谢您的帮助
下面是模板中的代码部分.当你有机会时,请你帮忙吗?谢谢.
<!-- TemplateBeginRepeat name="Component.Fields.section" -->
@@SetVariable("columnSectionIndex", "${TemplateRepeatIndex}")@@
Inline Value @@GetVariable("columnSectionIndex")@@ Variable value can be accessed
<!-- TemplateBeginRepeat name ="Field.links" -->
Inside Loop Value @@GetVariable("columnSectionIndex")@@ //Not getting declared variable //value here. Says variable doesn’t exist in ContextVariables.
<!-- TemplateBeginRepeat name ="Field.linkimages" -->
<!-- TemplateEndRepeat -->
<!-- TemplateEndRepeat -->
<!-- TemplateEndRepeat -->
Run Code Online (Sandbox Code Playgroud)
产量
Variable Added Successfully
Inline Value 0
Inside Loop Value Variable doesn't exist
Run Code Online (Sandbox Code Playgroud)
我的dwt代码
[TemplateCallable()]
public string SetVariable(string variableName, string value)
{
//Remove the old variable and set the …Run Code Online (Sandbox Code Playgroud) 我们正在开发基于Broker查询机制(过滤器)的基于.net的CT:
ComponentPresentationAssembler cpAssembler = new ComponentPresentationAssembler(Page ID,Page object);
Run Code Online (Sandbox Code Playgroud)
为了传递页面ID,我需要访问组件所在的页面.如何从包中访问该页面?由于这是一个CT,组件对象将在页面中可用,而不是页面对象.尝试了以下代码,但没有成功:
string pageURI = _package.GetValue("Page.ID");
Page objPage = (Page)_engine.GetSession().GetObject(pageURI);
Run Code Online (Sandbox Code Playgroud)
这不起作用,因为没有页面对象.有什么选择,以便我们可以从CT访问组件的父页面?