Bind the data to the GridView.?
Example:
protected void Page_Load(object sender, EventArgs e)
if (!IsPostBack)
SqlConnection connection = new
SqlConnection(connectionString);
SqlDataAdapter adapter = new SqlDataAdapter("SELECT
CustomerID, CustomerName FROM Customers", connection);
DataTable dataTable = new DataTable();
Follow:
adapter.Fill(dataTable);
GridView1.DataSource = dataTable;
GridView1.DataBind();
Here, GridView1 is bound to the data returned from the SQL query (SELECT
CustomerID, CustomerName FROM Customers), and the DataBind() method
displays it in the grid.