1
Answer

Export to excel from girdview satisfy conditions

Cao Cu Hao

Cao Cu Hao

9y
567
1

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)