get widget guid on InitializeControls
I am loading 3 custom widgets, that we created on PageLoad.
Each of these widgets are separate instances of the same object - an "AnswerKey"
When these each load I want to get the guid for that instance of the AnswerKey.
In debug, I can see the unique values for each of the properties of that instance of an AnswerKey, such as, answers, title, course; but I can't find the guid.
How do I get the guid for a particular instance of a widget while in the InitializeControls method?
Hello Phil,
Do you mean InitializeControls method of your own widget? Then you first must get a reference to the Page where the widget is, for example:
var manager = PageManager.GetManager();var page = manager.GetPageNodes().Where(p => p.Title == "Title").FirstOrDefault();foreach (var control in page.Page.Controls) var loaded = manager.LoadControl(control); if (loaded is ContentBlock) var guid = loaded.ID; Thanks. I'll be trying that this coming week.