Exemplo n.º 1
0
        protected void ImgBtnExportSchRsltToExcel_OnClick(object sender, ImageClickEventArgs e)
        {
            this.gvResult.AllowSorting = false;
            this.Export = true;
            string ret = "";

            foreach (DataGridItem c in this.gvResult.Items)
            {
                if (c.ItemType == ListItemType.Item || c.ItemType == ListItemType.AlternatingItem)
                {
                    CheckBox cb = ((CheckBox)c.Cells[7].FindControl("chkSelect"));
                    if (cb.Checked)
                    {
                        if (ret.Length > 0)
                        {
                            ret += ",";
                        }

                        ret += c.Cells[0].Text;
                    }
                }
            }

            if (this.SortExpression == PubEntAdminManager.strDefaultoSearchSorting)
            {
                if (ret.Length == 0)
                {
                    this.BindData_(((PubEntAdmin.BLL.Search)Session[PubEntAdminManager.strSearchCriteria]).PUBIDs);
                }
                else
                {
                    this.BindData_(ret);
                }
            }
            else
            {
                if (ret.Length == 0)
                {
                    this.BindData(((PubEntAdmin.BLL.Search)Session[PubEntAdminManager.strSearchCriteria]).PUBIDs);
                }
                else
                {
                    this.BindData(ret);
                }
            }

            this.gvResult.Columns[7].Visible = false;
            this.Export = false;
            ExportRoutines.ExportToExcel(this.Page, PubEntAdminManager.AdminSearchRptName(), PubEntAdminManager.DefAdminSearchResultRptTitle, this.gvResult);
        }