I was having trouble exporting Datagrid to Excel because it contained paging and sorting links. If you try to export with linkbuttons a runtime error will be thrown. I found this cool article which resolves this problem. Check it out Exporting Datagrid to Excel For Datagrid formatting issues view my article: Exporting Datagrid to Excel