本文介绍了从girdview导出到excel满足条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我根据搜索条件有一个LoadData函数并且生成 girdview ,我想从这个girdview导出数据到他们选择的路径。这是 LoadData 功能 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ìmthấy + dtb.Rows.Count.ToString()+ mãchiphí; grvDanhSach.DataSource = dtb; grvDanhSach.DataBind(); // ViewState [dtList] = dtb; } else { pnlDanhSach.GroupingText = Tìmthấy 0 mãchiphí; } mChiPhi = null ; } 这是查找 protected void lbtFind_Click( object sender,EventArgs e) { grvDanhSach.DataSource = null ; grvDanhSach.DataBind(); LoadData(cboPhongBan.SelectedValue,txtStartDate.Text.ToString(),txtToDate.Text.ToString()); } 程序是用asp.net c#编写的。有谁知道详细的帮助。谢谢 已添加预标签。 [/ Edit] 解决方案 试试这个。 http:// diamondafridi .blogspot.in /十二分之二千零十三/如何与出口数据值从 - grid.html 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 functionprivate 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 Findprotected 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[Edit member="Tadit"]Added pre tags.[/Edit] 解决方案 Try This.http://diamondafridi.blogspot.in/2013/12/how-to-export-data-values-from-grid.html 这篇关于从girdview导出到excel满足条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-17 22:14