Example #1
0
 /// <summary>
 /// Initializes a new instance of <see cref="ZentityDataGridView"/>.
 /// </summary>
 protected ZentityDataGridView()
     : base()
 {
     AutoGenerateColumns = false;
     this.AllowPaging    = true;
     this.ShowFooter     = this.ShowHeader = true;
     DataKeyNames        = new string[] { _idColumn };
     PageIndexChanging  += new GridViewPageEventHandler(GridView_PageIndexChanging);
     Sorting            += new GridViewSortEventHandler(GridView_Sorting);
     RowDataBound       += new GridViewRowEventHandler(GridView_RowDataBound);
     this.DataBound     += new EventHandler(ZentityDataGridView_DataBound);
 }
Example #2
0
        /// <summary>
        /// 引发 <see cref="PageIndexChanging"/> 事件
        /// </summary>
        /// <param name="e">事件数据</param>
        protected virtual void OnPageIndexChanging(GridViewPageEventArgs e)
        {
            GridViewPageEventHandler handler = (GridViewPageEventHandler)base.Events[EventPageIndexChanging];

            if (handler != null)
            {
                handler(this, e);
            }
            else if (!e.Cancel)
            {
                throw new Exception(string.Format("控件 {0} 未设置 {1} 事件", this.ID, "PageIndexChanging"));
            }
        }
Example #3
0
        /// <summary>引发 PageIndexChanging 事件</summary>
        /// <param name="e"></param>
        protected virtual void OnPageIndexChanging(GridViewPageEventArgs e)
        {
            //bool isBoundUsingDataSourceID = base.IsBoundUsingDataSourceID;
            GridViewPageEventHandler handler = (GridViewPageEventHandler)base.Events[EventPageIndexChanging];

            if (handler != null)
            {
                handler(this, e);
            }
            //else if (!isBoundUsingDataSourceID && !e.Cancel)
            //{
            //    throw new HttpException(SR.GetString("GridView_UnhandledEvent", new object[] { ID, "PageIndexChanging" }));
            //}
        }