Bonjour tout le monde.
j aimerais exporter le contenu d un datagrid vers Excel, pour cela ej fais :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
private void Button1_Click(object sender, System.EventArgs e)
		{
			DataSet dsResult = new DataSet();
			dsResult = (DataSet) Session["DataSetResult"];
			DataGrid1.DataSource = dsResult;
			DataGrid1.DataBind();
 
 
				//Response.Clear(); 
				Response.Buffer = true; 
				Response.ContentType = "application/vnd.ms-excel"; 
				Response.Charset = ""; 
				this.EnableViewState = false; 
				System.IO.StringWriter oStringWriter = new System.IO.StringWriter(); 
				System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter); 
 
				//optional function call to convert the controls to string literals 
				ClearControls(DataGrid1); //name the grid which u want to convert to excel 
				DataGrid1.RenderControl(oHtmlTextWriter); 
				Response.Write(oStringWriter.ToString()); 
 
				Response.End(); 
 
			}
apres complitation j ai la premiere ligne dans mon fichier excel mais pas le contenu de ma datagrid
quelqu un aurait une idée?
merci par avance
Nadaa