i found two mistake in your code:
dr["Color "] = "blue"; Column Color should without space dr["Color"] = "blue";
You forgot to add row to the table
table.Rows.Add(dr);
you can try this
public DataTable GetResultsTable()
{
DataTable table = new DataTable();
table.Columns.Add("Name".ToString());
table.Columns.Add("Color".ToString());
DataRow dr = table.NewRow();
dr["Name"] = "Mike";
dr["Color"] = "blue";
table.Rows.Add(dr);
return table;
}
public void gridview()
{
datagridview1.DataSource = GetResultsTable();
}