This example shows how to load an excel file from your computer to the server using ASPxUploadControl and then display its data in ASPxGridView.
To do this, you first need to place the ASPxGridView and ASPxUploadControl controls on a page and, secondly, handle the ASPxGridView.Init event and both the server-side and the client-side ASPxUploadControl.FileUploadControl events.
After uploading the excel file from your computer, save it in the "~/XlsTables/" directory using the ASPxUploadControl.FileUploadControl event handler on the server-side. You may choose any filename and then save it in the Session["FileName"] object to use later.
In the ASPxGridView.Init event handler you need to check the value of the Session["FileName"]object. If it's null, do nothing. Otherwise create a new DataTable and DataTableExporter objects.
Question Comments
Added By: John Daren Dizon 1 at: 5/11/2015 8:43:46 PM
So how can I save the data uploaded in the grid into a database?
Added By: Sergi (DevExpress Support) at: 5/12/2015 12:25:35 AMHello,
To process your recent post more efficiently, I created a separate ticket on your behalf: T240435: ASPxGridView How to save data from Excel to a database. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.