I had a datatable and i needed to show in a GridView in my ASP .Net page. Following is the code which help me to do so.
//get table to be shown in grid view; DataTable dataTable = GetRequiredTable(); //assing table to the DataSource property of GridView myGridView.DataSource=dataTable; //bind data from a data source to the GridView control myGridView.DataBind();
Here GetRequiredTable() is a user(example) function which return a table to display in to gridview.
You can also use DataSet in place of DataTable.