My code as follows
protected void btnimport_Click(object sender, EventArgs e)
{
string path = System.IO.Path.GetFileName(fileupload15.PostedFile.FileName);
fileupload15.PostedFile.SaveAs(Server.MapPath("~/Import_Excel/" + path));
GvSch.DataSource = ImportExcelXLS(path, false, out message);
GvSch.DataBind();
}
i create a new folder name called Import_Excel in that folder i want to save the selected excel file.
In run mode i click the choose file and select the excel file and click import button
When i run the above code shows error as follows
ilistsource does not contain any data sources
please help me.
what is the mistake from my above code.
protected void btnimport_Click(object sender, EventArgs e)
{
string path = System.IO.Path.GetFileName(fileupload15.PostedFile.FileName);
fileupload15.PostedFile.SaveAs(Server.MapPath("~/Import_Excel/" + path));
GvSch.DataSource = ImportExcelXLS(path, false, out message);
GvSch.DataBind();
}
i create a new folder name called Import_Excel in that folder i want to save the selected excel file.
In run mode i click the choose file and select the excel file and click import button
When i run the above code shows error as follows
ilistsource does not contain any data sources
please help me.
what is the mistake from my above code.
Kyle StoryPosted Nov 26, 2014, 4:19 AM
You have provided a very limited information about your issue. I'm guessing that GvSch is a GridView control and that ImportExcelXLS method converts the excel file to DataTable, right?
Then it is possible that an issue lies in that method and it is not generating the required data source for the GridView. Without seeing the method I cannot say for sure, but nevertheless here is a way you can read your uploaded XLS file in C# and then convert that XLS to a DataTable:
Suthish NairPosted Aug 28, 2014, 9:14 AM
Sahil SharmaPosted Aug 28, 2014, 8:14 AM