i have a issue while exporting Gridview data into .csv file.I have followed a link to export This link i have follow please chec开发者_Python百科k it. When I run the application it creates just header names, remaining body fields always show null values. Please help me how to export GridView data into .csv file
Maybe your GridView use the template fields, and your property «.Text» is always null.
Suggestion: Put a break-point just in «sw.Write(dr.Cells[i].Text);» and check your Cells[i] object. Search for the property you want to put in the file. Probably you will need to do some cast to catch the right value you want.
Ex.: sw.Write(((TextBox)dr.Cells[i].Controls[0]).Text);
Hope this helps.
精彩评论