Question

1
Replies
45
Views
MichaelD4660 Member since 2017 13 posts
Fifth Third Bank Bank
Posted: June 12, 2018
Last activity: November 6, 2018
Closed
Solved

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.

Robotic Process Automation
Moderation Team has archived post
Share this page LinkedIn