Exemple #1
0
        /// <summary>
        ///   Retrieves the text for the associated label.
        /// </summary>
        public static String GetLabelText(Control container, String associatedId, Boolean recursive = false)
        {
            var result = container.Children(recursive)
                                  .OfType<Label>()
                                  .Where(lbl => lbl.AssociatedControlID == associatedId)
                                  .Select(lbl => lbl.Text)
                                  .FirstOrDefault();

            if (result == null && !recursive) {
                return GetLabelText(container, associatedId, true);
            }

            return result;
        }