I have a webpage that has an Asp.Net ListView control that looks like a table. I would like to export it to an Excel file. I 'm trying to use the radGrid to do so by creating it in the code behind and placing it in a placeholder on the aspx page. I do not get any errors but my grid has no columns or rows, even though it showes as being databound. Any help would be appreciated. Here is my code for my button click to create radGrid.
RadGrid grid = new RadGrid();
grid.ID = "RadGrid1";
this.phExport.Controls.Add(grid);
grid.AutoGenerateColumns = true; //added for testing
grid.DataSource = FAM.ContactManager.Domain.Contact.GetExportData("2008","1"); //just returns a datatable
grid.Rebind();
grid.MasterTableView.ExportToExcel();
RadGrid grid = new RadGrid();
grid.ID = "RadGrid1";
this.phExport.Controls.Add(grid);
grid.AutoGenerateColumns = true; //added for testing
grid.DataSource = FAM.ContactManager.Domain.Contact.GetExportData("2008","1"); //just returns a datatable
grid.Rebind();
grid.MasterTableView.ExportToExcel();