Question

1
Replies
46
Views
Close popover
Michael Drake (MichaelD4660)
Fifth Third Bank Bank
Lead Software Engineer
Fifth Third Bank Bank
US
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,
Close popover This thread is closed to future replies. Content and links will no longer be updated. If you have the same/similar Question, please write a new Question.