我正在为网络营销人员使用Sitecore WebForms。我创建了一个自定义属性的自定义字段。自定义字段工作正常。
我想在单击提交按钮时阅读自定义属性,但我不知道如何阅读自定义属性。
在字段值中是C#参数属性,但这是null。如何读取自定义属性的值?
相关代码:
//Set values in dictionary
var values = new Dictionary<String, String>();
foreach (AdaptedControlResult field in fields)
{
values.Add(field.FieldName, field.Value);
}
答案 0 :(得分:2)
我想在保存操作中读取自定义属性的值。
字段参数为null,因为我没有覆盖Result以传递参数。
解决方案是覆盖自定义字段类中的结果。
/// <summary>
/// Override the result to get the selected value in the save action
/// </summary>
public override ControlResult Result
{
get
{
return new ControlResult(this.ControlName, this.textbox.Text, MaxLeadManagerFieldName);
}
}
第三个参数是保存操作字段属性中的参数字段。
使用自定义字段的属性填充此内容,您可以在保存操作中读取参数;)