Click here to Skip to main content
16,013,642 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
how we read the xml file data into gridview in asp.net
Posted
Comments
Sandeep Mewara 15-Jan-13 13:51pm    
Tried anything?

XML
<script runat="server">
    void Page_Load(Object sender, EventArgs e)
    {
        DataSet authorsDataSet;
        string filePath = Server.MapPath("Authors.xml");
        authorsDataSet = new DataSet();
        //Read the contents of the XML file into the DataSet
        authorsDataSet.ReadXml(filePath);
        authorsGird.DataSource = authorsDataSet.Tables[0].DefaultView;
        authorsGird.DataBind();
    }

</script>


Use this where required and give the path of xml file.
 
Share this answer
 
v4
Comments
amitnaik 15-Jan-13 10:21am    
onurag19, question is regarding excel (xls and xlsx) not XML. What u have written is for xml.
[no name] 15-Jan-13 12:59pm    
What ?how we read the xml file data into gridview in asp.net ? Please read the whole question then comment on it. .Got it
hi, There are numerous link available which will give answer to your question.
Have look at this link of codeproject.

How to import excel file to grid view in asp.net using c# AND save grid view to database sql server 2005[^] Have a look at the solution3.

This will definitely meet your expectation.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900