public void AssignCtrlID(EditorRoot root, EditorControl rootCtrl) { if ( (null == root) || (null == rootCtrl) ) { return; } do { root.CtrlCounter++; rootCtrl.CtrlID = root.editorName + "_" + rootCtrl.GetType() + "_" + (root.CtrlCounter).ToString(); EditorCtrlComposite rootCtrlComp = rootCtrl as EditorCtrlComposite; if (null == rootCtrlComp) { break; } foreach (var item in rootCtrlComp.children) { AssignCtrlID(root, item); } } while (false); }