In this article I’ll show you how to bind a gridview control using XML instead of taking any database table.
We will embed some data into the XML file and then we call that XML for binding purposes.Initial ChamberStep 1Open Your Visual Studio 2010 and create an empty website, provide a suitable name (gridview_demo).Step 2In Solution Explorer you get your empty website. Add a web form, SQL Database and XML file by going like this.For Web Form:gridview_demo (your empty website) then right-click then select Add New Item -> Web Form. Name it gridview_demo.aspx. For SQL Server Database:gridview_demo (your empty website) then right-click then select Add New Item -> SQL Server Database. (Add the database inside the App_Data_folder).For XML File:gridview_demo (your empty website) then right-click then select Add New Item -> XML File.We are using a SQL Server Database because of the connection string that we need to provide for binding purposes. Otherwise there is no use of the database since we are not using the database table. Instead we are using a Dataset.The following is the code of XML file:
ASP.NET GridView Control Pocket Guide