Exemplo n.º 1
0
        /// <summary>
        /// 设置DataGrid当前页码给DataGrid控件
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <remarks>
        ///  设置DataGrid当前页码给DataGrid控件
        /// </remarks>
        private void SetDataGridPageIndexToControl(int pageIndex)
        {
            if (this._Control != null)
            {
                System.Type             type             = this._Control.GetType();
                IPagerBoundControlType  pagerControlType = new PagerBoundControlType();
                PagerBoundControlStatus pbControlStatus  = new PagerBoundControlStatus();

                pbControlStatus = pagerControlType.GetPagerBoundControl(type);

                MethodInfo mi = type.GetMethod("OnPageIndexChanged", BindingFlags.Instance | BindingFlags.NonPublic);

                IPageEventArgs eventArgs = new PageEventArgs();

                mi.Invoke(this._Control, new object[] { eventArgs.GetPageEventArgs(pbControlStatus.DataListControlType, "EventPageIndexChanged", (object)this._Control, pageIndex) });
                PropertyInfo pi = type.GetProperty("CurrentPageIndex");

                if (pi != null)
                {
                    if (pi.CanWrite)
                    {
                        pi.SetValue(this._Control, pageIndex, null);
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 设置当前页码给控件
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <remarks>
        ///  设置当前页码给控件
        /// </remarks>
        private void SetPageIndexToControl(int pageIndex)
        {
            if (this._BoundControl != null)
            {
                System.Type             type             = this._BoundControl.GetType();
                IPagerBoundControlType  pagerControlType = new PagerBoundControlType();
                PagerBoundControlStatus pbControlStatus  = pagerControlType.GetPagerBoundControl(type);

                MethodInfo mi = type.GetMethod("OnPageIndexChanging", BindingFlags.Instance | BindingFlags.NonPublic);

                IPageEventArgs eventArgs = new PageEventArgs();
                mi.Invoke(this._BoundControl, new object[] { eventArgs.GetPageEventArgs(pbControlStatus.DataListControlType, "EventPageIndexChanging", null, pageIndex) });

                PropertyInfo pi = type.GetProperty("PageIndex");

                if (pi != null)
                {
                    if (pi.CanWrite)
                    {
                        pi.SetValue(this._BoundControl, pageIndex, null);

                        MethodInfo miChanged = type.GetMethod("OnPageIndexChanged", BindingFlags.Instance | BindingFlags.NonPublic);

                        if (miChanged != null)
                        {
                            miChanged.Invoke(this._BoundControl, new object[] { new EventArgs() });
                        }
                    }
                }
            }

            //单独处理DataGrid
            if (this._Control != null)
            {
                System.Type             type             = this._Control.GetType();
                IPagerBoundControlType  pagerControlType = new PagerBoundControlType();
                PagerBoundControlStatus pbControlStatus  = pagerControlType.GetPagerBoundControl(type);

                if (pbControlStatus.DataListControlType == DataListControlType.DataGrid)
                {
                    if (PagerSettings.Mode == DeluxePagerMode.Numeric && pageIndex == PageCount)
                    {
                        pageIndex = pageIndex - 1;
                    }

                    this.SetDataGridPageIndexToControl(pageIndex);
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 设置DataGrid当前页码给DataGrid控件
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <remarks>
        ///  设置DataGrid当前页码给DataGrid控件
        /// </remarks>
        private void SetDataGridPageIndexToControl(int pageIndex)
        {
            if (this._Control != null)
            {
                System.Type type = this._Control.GetType();
                IPagerBoundControlType pagerControlType = new PagerBoundControlType();
                PagerBoundControlStatus pbControlStatus = new PagerBoundControlStatus();

                pbControlStatus = pagerControlType.GetPagerBoundControl(type);

                MethodInfo mi = type.GetMethod("OnPageIndexChanged", BindingFlags.Instance | BindingFlags.NonPublic);

                IPageEventArgs eventArgs = new PageEventArgs();

                mi.Invoke(this._Control, new object[] { eventArgs.GetPageEventArgs(pbControlStatus.DataListControlType, "EventPageIndexChanged", (object)this._Control, pageIndex) });
                PropertyInfo pi = type.GetProperty("CurrentPageIndex");

                if (pi != null)
                    if (pi.CanWrite)
                        pi.SetValue(this._Control, pageIndex, null);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 设置当前页码给控件
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <remarks>
        ///  设置当前页码给控件
        /// </remarks>
        private void SetPageIndexToControl(int pageIndex)
        {
            if (this._BoundControl != null)
            {
                System.Type type = this._BoundControl.GetType();
                IPagerBoundControlType pagerControlType = new PagerBoundControlType();
                PagerBoundControlStatus pbControlStatus = pagerControlType.GetPagerBoundControl(type);

                MethodInfo mi = type.GetMethod("OnPageIndexChanging", BindingFlags.Instance | BindingFlags.NonPublic);

                IPageEventArgs eventArgs = new PageEventArgs();
                mi.Invoke(this._BoundControl, new object[] { eventArgs.GetPageEventArgs(pbControlStatus.DataListControlType, "EventPageIndexChanging", null, pageIndex) });

                PropertyInfo pi = type.GetProperty("PageIndex");

                if (pi != null)
                {
                    if (pi.CanWrite)
                    {
                        pi.SetValue(this._BoundControl, pageIndex, null);

                        MethodInfo miChanged = type.GetMethod("OnPageIndexChanged", BindingFlags.Instance | BindingFlags.NonPublic);

                        if (miChanged != null)
                            miChanged.Invoke(this._BoundControl, new object[] { new EventArgs() });
                    }
                }
            }

            //单独处理DataGrid 
            if (this._Control != null)
            {
                System.Type type = this._Control.GetType();
                IPagerBoundControlType pagerControlType = new PagerBoundControlType();
                PagerBoundControlStatus pbControlStatus = pagerControlType.GetPagerBoundControl(type);

                if (pbControlStatus.DataListControlType == DataListControlType.DataGrid)
                {
                    if (PagerSettings.Mode == DeluxePagerMode.Numeric && pageIndex == PageCount)
                        pageIndex = pageIndex - 1;

                    this.SetDataGridPageIndexToControl(pageIndex);
                }
            }
        }