/// <summary>
        /// Searches in the current control for a control that matches the search parameters
        /// </summary>
        /// <typeparam name="T1"></typeparam>
        /// <param name="searchParameters"></param>
        /// <returns></returns>
        public new T1 Get <T1>(string searchParameters) where T1 : IEnhancedHtmlControl
        {
            if (string.IsNullOrWhiteSpace(Selector))
            {
                return(base.Get <T1>(searchParameters));
            }
            string selector    = string.Format("{0} {1}", Selector, searchParameters);
            var    control     = EnhancedHtmlControlBaseFactory.Create <T1>(Page, selector);
            var    baseControl = Page.FindControlBySelector(control.GetBaseType(), selector);

            control.Wrap(baseControl, false);
            return(control);
        }
        /// <summary>
        /// Finds controls inside the current control that match the search criteria
        /// </summary>
        /// <typeparam name="T1"></typeparam>
        /// <param name="elementSelector"></param>
        /// <returns></returns>
        public IEnumerable <T1> Find <T1>(string elementSelector) where T1 : IEnhancedHtmlControl
        {
            string selector     = string.Format("{0} {1}", Selector, elementSelector);
            T1     control      = EnhancedHtmlControlBaseFactory.Create <T1>(Page, selector);
            var    baseControls = Page.FindControlsBySelector(control.GetBaseType(), selector);

            return(baseControls.Select(x =>
            {
                var c = EnhancedHtmlControlBaseFactory.Create <T1>(Page, selector);
                c.Wrap(x, false);
                return c;
            }));
        }
Пример #3
0
        /// <summary>
        /// Gets the Highway.Insurance control object when search parameters are passed.
        /// You don't have to create the object repository entry for this.
        /// </summary>
        /// <typeparam name="T">Pass the Highway.Insurance control you are looking for.</typeparam>
        /// <param name="searchParameters">In 'Key1=Value1;Key2=Value2' format. For example 'Id=firstname'</param>
        /// <returns>Highway.Insurance _* control object</returns>
        public T Get <T>(string searchParameters = null)
            where T : IEnhancedHtmlControl
        {
            T control = EnhancedHtmlControlBaseFactory.Create <T>(searchParameters);

            if (typeof(T).Namespace.Equals("Highway.Insurance.Controls.SilverlightControls"))
            {
                var baseControl = Activator.CreateInstance(control.GetBaseType(), new object[] { this.SlObjectContainer });
                control.Wrap(baseControl);
            }
            else if (typeof(T).Namespace.Equals("Highway.Insurance.Controls.TelerikControls"))
            {
                var baseControl = Activator.CreateInstance(control.GetBaseType(), new object[] { this.SlObjectContainer });
                (control as TelerikControls.TelerikComboBox).SetWindow(this);
            }
            else
            {
                var baseControl = Activator.CreateInstance(control.GetBaseType(), new object[] { this });
                control.Wrap(baseControl);
            }

            return(control);
        }