且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从girdview导出到excel满足条件

更新时间:2023-11-04 13:41:40

试试这个。



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 function

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

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


[Edit member="Tadit"]
Added pre tags.
[/Edit]

Try This.

http://diamondafridi.blogspot.in/2013/12/how-to-export-data-values-from-grid.html