Ejemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     dsReportTableAdapters.dtUsersOfAdminTableAdapter dtUsersOfAdminTA = new dsReportTableAdapters.dtUsersOfAdminTableAdapter();
     dsReport.dtUsersOfAdminDataTable dtUsersOfAdminDT = new dsReport.dtUsersOfAdminDataTable();
     dtUsersOfAdminDT   = dtUsersOfAdminTA.GetUsersOfAdmin();
     gvUsers.DataSource = dtUsersOfAdminDT;
     gvUsers.DataBind();
     lblResult.Text = "Number of users: <b>" + dtUsersOfAdminDT.Rows.Count + "</b>";
 }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        dsReportTableAdapters.dtUsersOfAdminTableAdapter dtUsersOfAdminTA = new dsReportTableAdapters.dtUsersOfAdminTableAdapter();
        dsReport.dtUsersOfAdminDataTable dtUsersOfAdminDT = new dsReport.dtUsersOfAdminDataTable();
        dtUsersOfAdminDT = dtUsersOfAdminTA.GetUsersOfAdmin();

        //dsReportTableAdapters.dtUsersByRequestorTableAdapter dtUsersByRequestorTA = new dsReportTableAdapters.dtUsersByRequestorTableAdapter();
        //dsReport.dtUsersByRequestorDataTable dtUsersByRequestorDT = new dsReport.dtUsersByRequestorDataTable();
        //dtUsersByRequestorDT = dtUsersByRequestorTA.GetUsersByRequestor(Convert.ToInt32(Request.QueryString["id"].ToString()));
        //gvUsers.DataSource = dtUsersByRequestorDT;
        gvUsers.DataSource = dtUsersOfAdminDT;
        gvUsers.DataBind();

        //dsCompanyTableAdapters.dtRequestorLastNameTableAdapter dtRequestorLastNameTA = new dsCompanyTableAdapters.dtRequestorLastNameTableAdapter();
        //dsCompany.dtRequestorLastNameDataTable dtRequestorLastNameDT = new dsCompany.dtRequestorLastNameDataTable();
        //dtRequestorLastNameDT = dtRequestorLastNameTA.GetRequestorLastNameByID(Convert.ToInt32(Request.QueryString["id"].ToString()));


        Response.Clear();
        Response.ClearHeaders();                                  //For HTTPS
        Response.Cache.SetCacheability(HttpCacheability.Private); //For HTTPS

        //Response.AddHeader("content-disposition", "attachment; filename=SpifeAssociates"+Convert.ToDateTime(AssociatesDT.Rows[0]["downloaddate"].ToString()).ToShortDateString()+".xls");
        Response.AddHeader("content-disposition", "attachment; filename=admin_list.xls");
        Response.Charset = "";
        //Response.Cache.SetCacheability(HttpCacheability.NoCache);
        //
        //Response.AddHeader("Content-Type", "application/vnd.ms-excel");
        Response.ContentType = "application/vnd.xls";
        System.IO.StringWriter       stringWrite = new System.IO.StringWriter();
        System.Web.UI.HtmlTextWriter htmlWrite   = new HtmlTextWriter(stringWrite);

        gvUsers.RenderControl(htmlWrite);

        /*
         * sqlDataAdapter1.Fill(dsDownload1, "users");
         * if (!Page.IsPostBack)
         * {
         *  dgDownload.DataSource = dsDownload1;
         *  dgDownload.DataBind();
         * }
         * dgDownload.RenderControl(htmlWrite);
         */
        Response.Write(stringWrite.ToString());
        Response.End();
    }