Question
Fifth Third Bank Bank
US
Last activity: 6 Nov 2018 20:02 EST
How to determine if a control is cloneable
How can it be determined in a C# script whether a passed in control is cloneable or not? I don't see any properties that would indicate this, and the documentation seems to be lacking in this regard.
I have a C# script method that is receiving a container web control as a parameter. The method iterates through the control's child web controls to set next keys for those controls having the UseKeys property set to true. I want to prevent raising errors for those child controls that are not cloneable... something like the following:
// pseudocode, since IsCloneable is not a real property
if (ctrl.IsCloneable)
{
ctrl.SetNextKey
}
I have tried the following check, but it doesn't return an expected result.
if (ctrl is ICloneable)
{
// returns false even for controls using keys
}
// or...
if (ctrl.GetType() is ICloneable)
{
// returns true even for controls NOT using keys
}
I am using Visual Studio 2015, with the Pega plugin v.8.0.1081.