Cao Cu Hao

Cao Cu Hao

  • NA
  • 22
  • 5.8k

Export to excel from girdview satisfy conditions

Dec 7 2014 10:50 PM

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

<code>

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 <u>" + dtb.Rows.Count.ToString() + "</u> mã chi phí";

grvDanhSach.DataSource = dtb;

grvDanhSach.DataBind();

//ViewState["dtList"] = dtb;

}

else

{

pnlDanhSach.GroupingText = "Tìm th?y <u>0</u> mã chi phí";

}

mChiPhi = null;

}

</code>

and this is Find

<code>

protected void lbtFind_Click(object sender, EventArgs e)

{

grvDanhSach.DataSource = null;

grvDanhSach.DataBind();

LoadData(cboPhongBan.SelectedValue, txtStartDate.Text.ToString(), txtToDate.Text.ToString());

}

</code>

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


Answers (1)