예제 #1
0
        protected virtual void DoQuery()
        {
            DtSource = new DataTable();
            this.gridWebGrid.ClearDataSource();
            this.gridWebGrid.Columns.Clear();
            gridHelper = new GridHelperNew(this.gridWebGrid, DtSource);

            //            string script = @"
            //
            //                                             var grid=$('#gridWebGrid');
            //                                             var chartDiv=$('div[id$=\'Chart\']');
            //                                             if(grid.html()!=null)
            //                                             {
            //                                                 grid.closest('tr').closest('tr').css('display','block');
            //                                             }
            //                                             else if(chartDiv.html()!=null)
            //                                             {
            //                                                 chartDiv.closest('tr').closest('tr').css('display','block');
            //                                             }";
            //            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "SetDisplayBlock", script, true);
        }
예제 #2
0
        private void InitOnPostBack()
        {
            #region ButtonHelper
            this.buttonHelper = new ButtonHelper(this);
            this.buttonHelper.SetEditObjectHandle         = new SetEditObjectDelegate(this.SetEditObject);
            this.buttonHelper.AfterPageStatusChangeHandle = new PageStatusChangeDelegate(this.buttonHelper_AfterPageStatusChangeHandle);

            //没有绑定事件的才需要新增点击事件
            if (this.buttonHelper.CmdAdd != null && buttonHelper.CmdAdd.Attributes["bindclick"] == null)
            {
                this.buttonHelper.CmdAdd.ServerClick += new EventHandler(cmdAdd_Click);
            }

            if (this.buttonHelper.CmdSelect != null && buttonHelper.CmdSelect.Attributes["bindclick"] == null)
            {
                this.buttonHelper.CmdSelect.ServerClick += new EventHandler(cmdSelect_Click);
            }

            if (this.buttonHelper.CmdDelete != null && buttonHelper.CmdDelete.Attributes["bindclick"] == null)
            {
                this.buttonHelper.CmdDelete.ServerClick += new EventHandler(cmdDelete_Click);
            }

            if (this.buttonHelper.CmdSave != null && buttonHelper.CmdSave.Attributes["bindclick"] == null)
            {
                this.buttonHelper.CmdSave.ServerClick += new EventHandler(cmdSave_Click);
            }

            if (this.buttonHelper.CmdCancel != null && buttonHelper.CmdCancel.Attributes["bindclick"] == null)
            {
                this.buttonHelper.CmdCancel.ServerClick += new EventHandler(cmdCancel_Click);
            }

            if (this.buttonHelper.CmdQuery != null && buttonHelper.CmdQuery.Attributes["bindclick"] == null)
            {
                this.buttonHelper.CmdQuery.ServerClick += new EventHandler(cmdQuery_Click);
            }

            if (this.buttonHelper.CmdExport != null && buttonHelper.CmdExport.Attributes["bindclick"] == null)
            {
                this.buttonHelper.CmdExport.ServerClick += new EventHandler(cmdExport_Click);
            }
            #endregion

            #region GridHelper
            foreach (WebDataGrid item in listGrid)
            {
                if (item.ID == "gridWebGrid")
                {
                    this.gridHelper = new GridHelperNew(this.gridWebGrid, this.DtSource);
                    this.gridHelper.LoadDataSourceHandle = new LoadDataSourceDelegateNew(this.LoadDataSource);
                    this.gridHelper.GetRowCountHandle    = new GetRowCountDelegateNew(this.GetRowCount);
                    this.gridHelper.BuildGridRowhandle   = new BuildGridRowDelegateNew(this.GetGridRow);
                }
                else if (item.ID == "gridWebGrid2")
                {
                    this.gridHelper2 = new GridHelperNew(this.gridWebGrid2, this.DtSource2);
                    this.gridHelper2.LoadDataSourceHandle = new LoadDataSourceDelegateNew(this.LoadDataSource2);
                    this.gridHelper2.GetRowCountHandle    = new GetRowCountDelegateNew(this.GetRowCount2);
                    this.gridHelper2.BuildGridRowhandle   = new BuildGridRowDelegateNew(this.GetGridRow2);
                }
                else if (item.ID == "gridWebGrid3")
                {
                    this.gridHelper3 = new GridHelperNew(this.gridWebGrid3, this.DtSource3);
                    this.gridHelper3.LoadDataSourceHandle = new LoadDataSourceDelegateNew(this.LoadDataSource3);
                    this.gridHelper3.GetRowCountHandle    = new GetRowCountDelegateNew(this.GetRowCount3);
                    this.gridHelper3.BuildGridRowhandle   = new BuildGridRowDelegateNew(this.GetGridRow3);
                }
            }
            #endregion

            #region Exporter
            this.excelExporter.LoadExportDataHandle      = new LoadExportDataDelegate(LoadDataSource);
            this.excelExporter.FormatExportRecordHandle  = new FormatExportRecordDelegate(FormatExportRecord);
            this.excelExporter.GetColumnHeaderTextHandle = new GetColumnHeaderTextDelegate(GetColumnHeaderText);
            #endregion
        }