Ejemplo 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);
                    }
                }
            }
        }
Ejemplo 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);
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 绑定数据控件
        /// </summary>
        /// <remarks>
        ///  绑定数据控件
        /// </remarks>
        private void BindDataControl()
        {
            BaseDataBoundControl boundControl = (BaseDataBoundControl)this.Page.FindControlByID(this.DataBoundControlID, true);

            if (boundControl != null)
            {
                System.Type             type             = boundControl.GetType();
                IPagerBoundControlType  pagerControlType = new PagerBoundControlType();
                PagerBoundControlStatus pbControlStatus  = pagerControlType.GetPagerBoundControl(type);

                if (pbControlStatus.DataListControlType != DataListControlType.DataGrid)
                {
                    boundControl.DataBound += new EventHandler(BoundControl_DataBound);
                    this._BoundControl      = boundControl;
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 初始化控件
        /// </summary>
        /// <param name="e"></param>
        /// <remarks>
        ///  初始化控件
        /// </remarks>
        protected override void OnInit(EventArgs e)
        {
            if (!this.DesignMode)
            {
                this._Control = (Control)this.Page.FindControlByID(this.DataBoundControlID, true);

                if (this._Control != null)
                {
                    //设置绑定对应控件的分页属性
                    IPageEventArgs ipea = new PageEventArgs();

                    IPagerBoundControlType  pagerControlType = new PagerBoundControlType();
                    PagerBoundControlStatus pbControlStatus  = pagerControlType.GetPagerBoundControl(this._Control.GetType());

                    ipea.SetBoundControlPagerSetting(this._Control, pbControlStatus.DataListControlType, this.PageSize);

                    if (pbControlStatus.IsPagedControl && this.IsPagedControl && DataBoundControlID != string.Empty)
                    {
                        //DataGrid与其它具有翻页功能控件的机制不同,由于继承的基类不同,因此这里排除DataGrid类型
                        if (pbControlStatus.DataListControlType != DataListControlType.DataGrid)
                        {
                            this.BindDataControl();
                        }
                        else
                        {
                            this.DataGridDataSource();
                        }
                    }
                }

                if (this.Page != null)
                {
                    this.Page.PreRenderComplete += new EventHandler(Page_PreRenderComplete);
                }
                base.OnInit(e);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 绑定数据控件
        /// </summary>
        /// <remarks>
        ///  绑定数据控件
        /// </remarks>
        private void BindDataControl()
        {
            BaseDataBoundControl boundControl = (BaseDataBoundControl)this.Page.FindControlByID(this.DataBoundControlID, true);

            if (boundControl != null)
            {
                System.Type type = boundControl.GetType();
                IPagerBoundControlType pagerControlType = new PagerBoundControlType();
                PagerBoundControlStatus pbControlStatus = pagerControlType.GetPagerBoundControl(type);

                if (pbControlStatus.DataListControlType != DataListControlType.DataGrid)
                {
                    boundControl.DataBound += new EventHandler(BoundControl_DataBound);
                    this._BoundControl = boundControl;
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 初始化控件
        /// </summary>
        /// <param name="e"></param>
        /// <remarks>
        ///  初始化控件
        /// </remarks>
        protected override void OnInit(EventArgs e)
        {
            if (!this.DesignMode)
            {
                this._Control = (Control)this.Page.FindControlByID(this.DataBoundControlID, true);

                if (this._Control != null)
                {
                    //设置绑定对应控件的分页属性
                    IPageEventArgs ipea = new PageEventArgs();

                    IPagerBoundControlType pagerControlType = new PagerBoundControlType();
                    PagerBoundControlStatus pbControlStatus = pagerControlType.GetPagerBoundControl(this._Control.GetType());

                    ipea.SetBoundControlPagerSetting(this._Control, pbControlStatus.DataListControlType, this.PageSize);

                    if (pbControlStatus.IsPagedControl && this.IsPagedControl && DataBoundControlID != string.Empty)
                    {
                        //DataGrid与其它具有翻页功能控件的机制不同,由于继承的基类不同,因此这里排除DataGrid类型
                        if (pbControlStatus.DataListControlType != DataListControlType.DataGrid)
                            this.BindDataControl();
                        else
                            this.DataGridDataSource();
                    }
                }

                if (this.Page != null)
                {
                    this.Page.PreRenderComplete += new EventHandler(Page_PreRenderComplete);
                }
                base.OnInit(e);
            }
        }
Ejemplo n.º 7
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);
            }
        }
Ejemplo n.º 8
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);
                }
            }
        }