protected void gvReport_Sorting(object sender, GridViewSortEventArgs e)
        {
            DonorEventList DEL = new DonorEventList(User.Identity.Name);
            EventList      EL  = new EventList(User.Identity.Name, int.Parse(Request["eid"].ToString()));



            string[] SortOrder = ViewState["SortExpr"].ToString().Split(' ');
            if (SortOrder[0] == e.SortExpression)
            {
                if (SortOrder[1] == "ASC")
                {
                    ViewState["SortExpr"] = e.SortExpression + " " + "DESC";
                }
                else
                {
                    ViewState["SortExpr"] = e.SortExpression + " " + "ASC";
                }
            }
            else
            {
                ViewState["SortExpr"] = e.SortExpression + " " + "ASC";
            }

            gvReport.PageIndex  = 0;
            gvReport.DataSource = DEL.GetDonorEventList_ByEvent(EL.pk_Event, ViewState["SortExpr"].ToString());
            gvReport.DataBind();
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string attachment = "attachment; filename=EventGuestList-Excel_" + DateTime.Now.ToString() + ".xls";

            Response.ClearContent();
            Response.AddHeader("content-disposition", attachment);
            Response.ContentType = "application/ms-excel";

            if (Request["eid"] != null)
            {
                DonorEventList DEL = new DonorEventList(User.Identity.Name);
                EventList      EL  = new EventList(User.Identity.Name, int.Parse(Request["eid"].ToString()));

                gvExcel.DataSource = DEL.GetDonorEventList_ByEvent(EL.pk_Event);
                gvExcel.DataBind();
            }
        }
        private void DataBind(int pPageIndex = 0)
        {
            if (pPageIndex <= 0)
            {
                pPageIndex = 0;
            }
            else
            {
                if (pPageIndex > gvReport.PageCount)
                {
                    pPageIndex = gvReport.PageCount;
                }
            }

            DonorEventList DEL = new DonorEventList(User.Identity.Name);
            EventList      EL  = new EventList(User.Identity.Name, int.Parse(Request["eid"].ToString()));

            gvReport.PageIndex  = pPageIndex;
            gvReport.DataSource = DEL.GetDonorEventList_ByEvent(EL.pk_Event, ViewState["SortExpr"].ToString());
            gvReport.DataBind();
        }