Skip to content

Export to excel from girdview satisfy conditions

Cao Cu Hao

Asked Dec 7, 2014, 5:50 PM EST1 answer
Share
LinkedInX

I have a LoadData function according to the search criteria and make girdview, I want to export data to excel from this girdview the path they have chosen.This is LoadData function

C#
private void LoadData(string idPB, string StartDate, string ToDate)
    {
        hmweb.Services.cChuyenMuc mChiPhi = new hmweb.Services.cChuyenMuc();
        DataTable dtb = new DataTable();
        dtb = mChiPhi.ChiPhi_Search(idPB, StartDate, ToDate);
        if (dtb.Rows.Count > 0)
        {
            pnlDanhSach.GroupingText = "Tìm th?y " + dtb.Rows.Count.ToString() + " mã chi phí";
            grvDanhSach.DataSource = dtb;
            grvDanhSach.DataBind();
            //ViewState["dtList"] = dtb;
        }
        else
        {
            pnlDanhSach.GroupingText = "Tìm th?y 0 mã chi phí";
        }
        mChiPhi = null;
    }

and this is Find

TypeScript
protected void lbtFind_Click(object sender, EventArgs e)
    {
        grvDanhSach.DataSource = null;
        grvDanhSach.DataBind();
        LoadData(cboPhongBan.SelectedValue, txtStartDate.Text.ToString(), txtToDate.Text.ToString());
    }

he program is written in asp.net c #. Does anyone know detailed help. Thank you

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 1 short reply
    • 0
      no one can help me?
      0