protected void RegisterPoupMenuItem(string commandName, string formatName, string imageName, Action <object> action) { var localizedCaption = GetLocalizedCaption(commandName); if (formatName != "") { localizedCaption = string.Format(GetLocalizedCaption(formatName), localizedCaption); } var buttonItem = new BarButtonItemEx(imageName, null) { Caption = localizedCaption }; buttonItem.ItemClick += (s, e) => { var focusedObject = EntityGridView.GetRow(EntityGridView.FocusedRowHandle); if (formatName != "") { action(commandName); } else { action(focusedObject); } }; popupMenu.AddItem(buttonItem); }