Click here to Skip to main content
15,890,377 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
C#
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]
Posted
v2
Comments
syed shanu 7-Dec-14 23:26pm    
Where is your export to excel code

1 solution

Try This.

http://diamondafridi.blogspot.in/2013/12/how-to-export-data-values-from-grid.html
 
Share this answer
 
Comments
haocaocu 9-Dec-14 2:39am    
I like you but I try not to get datatable returns should not run the export function

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900