Question

I'm using Sitecore WebForms for Marketeers. I have created a custom field with a custom property. The custom field works fine.

I want to read the custom property when I click on the submit button, but I do not know how I can read the custom property.

In the field value is the C# parameter property, but this is null. How can I read the value of the custom property?

Relevant code:

   //Set values in dictionary
    var values = new Dictionary<String, String>();
    foreach (AdaptedControlResult field in fields)
    {
        values.Add(field.FieldName, field.Value);
    }
Was it helpful?

Solution

I wanted to read the value of custom property in a save action.
The field parameters was null because I didn't override the Result to pass the parameters.

Solution is to override the Result in your Custom Field Class.

/// <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);
    }
}

The third parameter is the parameter field in the save action field property.
Fill this with the property of your custom field and you can read the parameters in your save action ;)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top