Beispiel #1
0
        /// <devdoc>
        /// Returns an IEnumerable that is the DataSource, which either came
        /// from the DataSource property or from the control bound via the
        /// DataSourceID property.
        /// </devdoc>
        protected virtual IEnumerable GetData()
        {
            DataSourceView view = ConnectToDataSourceView();

            Debug.Assert(_currentViewValid);

            if (view != null)
            {
                // DevDiv 1070535: enable async model binding for Repeater
                bool useAsyncSelect = false;
                if (AppSettings.EnableAsyncModelBinding)
                {
                    var modelDataView = view as ModelDataSourceView;
                    useAsyncSelect = modelDataView != null && modelDataView.IsSelectMethodAsync;
                }

                if (useAsyncSelect)
                {
                    _asyncSelectPending = true; // disable post data binding action until the callback is invoked
                    view.Select(SelectArguments, OnDataSourceViewSelectCallback);
                }
                else
                {
                    return(view.ExecuteSelect(SelectArguments));
                }
            }

            return(null);
        }
Beispiel #2
0
        protected override void OnDataBinding(EventArgs e)
        {
            base.OnDataBinding(e);
            DataSourceView view = GetData();

            // view could be null when a user implements his own GetData().
            if (null == view)
            {
                throw new InvalidOperationException(SR.GetString(SR.DataControl_ViewNotFound, ID));
            }

            // DevDiv 1036362: enable async model binding for ListControl
            bool useAsyncSelect = false;

            if (AppSettings.EnableAsyncModelBinding)
            {
                var modelDataView = view as ModelDataSourceView;
                useAsyncSelect = modelDataView != null && modelDataView.IsSelectMethodAsync;
            }

            if (useAsyncSelect)
            {
                _asyncSelectPending = true; // disable post data binding action until the callback is invoked
                view.Select(SelectArguments, OnDataSourceViewSelectCallback);
            }
            else
            {
                IEnumerable data = view.ExecuteSelect(DataSourceSelectArguments.Empty);
                PerformDataBinding(data);
            }
        }
        protected virtual IEnumerable GetData()
        {
            DataSourceView view = this.ConnectToDataSourceView();

            if (view != null)
            {
                return(view.ExecuteSelect(this.SelectArguments));
            }
            return(null);
        }
        /// <devdoc>
        /// Returns an IEnumerable that is the DataSource, which either came
        /// from the DataSource property or from the control bound via the
        /// DataSourceID property.
        /// </devdoc>
        protected virtual IEnumerable GetData()
        {
            DataSourceView view = ConnectToDataSourceView();

            Debug.Assert(_currentViewValid);

            if (view != null)
            {
                return(view.ExecuteSelect(DataSourceSelectArguments.Empty));
            }
            return(null);
        }