Here Mudassar Ahmed Khan has explained with an example, how to export WebGrid to Excel file with formatting in ASP.Net MVC Razor.
First the WebGrid will be populated from database using Entity Framework and then the generated HTML Table of WebGrid will be sent as HTML string to the Controller which ultimately will be exported to Excel file in ASP.Net MVC Razor.
↧