C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




How to upload an excel file into a gridview in asp.net???


Posted Date: 14 Sep 2007      Total Responses: 1

Posted By: Subhrangshu Banerjee       Member Level: Bronze     Points: 2


i want to upload an excel file into a gridview in a asp.net page.

A File upload area where the person can select an excel file to upload, a button to upload and then a gridview which will display the uploaded data.

Is this possible?

If it is then please suggest me in details how to proceed ...

thanking you.





Responses

Author: Anjum Rizwi    14 Sep 2007Member Level: SilverRating:     Points: 2
Hi Subhrangshu Banerjee,
Please follow these sample instruction


public void UploadData()
{
string uploadedFilePath = UploadFile();
string strConnectionString = "Provider Name=" + uploadedFilePath;

DataSet ds = new DataSet();
//A-Z is column number of excel file
OleDbDataAdapter da = new OleDbDataAdapter("SElect * from [A-Z]", strConnectionString);

da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
}
private string UploadFile()
{
//write code here for upload
string uploadedFilePath; //Assign uploaded physical path
return uploadedFilePath;
}



Post Reply
You must Sign In to post a response.
Next : i have tried placing itembond code above the page bt nt working.(Datagrid column adding)
Previous : i have tried changing (e.item.itemtype!=header) to (e.item.itemtype==item) bt no use
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

budget conference call

Contact Us    Privacy Policy    Terms Of Use