After much research, I've discovered that there was only one other post that raised this problem. For completeness, here is the url:
Incorrect results when looping over recordset using Webmatrix/Mono/MySQL
After testing in a variety of ways, it seems the problem is with mono not executing the sql query correctly. Given that no one else appears to have logged this as a problem, I can only assume that it is a bug in my installation.
Anyway, as a work around, here is my solution for using webgrid in case others may be interested.
@using System.Collections;
@using System;
@using System.Data;
@using System.Data.SqlClient;
@using System.Dynamic;
@using System.Text;
@using System.Configuration;
@using MySql.Data.MySqlClient;
@{
//establish a connection to mysql db using the connection in web.config
MySqlConnection dbConn = new MySqlConnection(ConfigurationManager.ConnectionStrings["myStringName"].ConnectionString);
//====From here, source data is member table in database=====
//create a mysql command var to store the sql query and reference to the connection string
MySqlCommand command1 = new MySqlCommand("SELECT Id, Fname, Lname, Company, Email FROM ClientTable", dbConn);
//create a mysql adapter to call the command to be executed
MySqlDataAdapter dap1 = new MySqlDataAdapter(command1);
//create a dataset to capture the results of the sql query
DataSet dataset1 = new DataSet();
//use the adapter to fill data with the results of the query.
//ClientTable will be the name of the table in dataset.
dap1.Fill(dataset1, "ClientTable");
//iterate dataset to store its info into a list with columnnames
var clientProfile = new List<dynamic>();
foreach (DataRow dr in dataset1.Tables["ClientTable"].Rows)
{
var obj = (IDictionary<string, object>)new ExpandoObject();
foreach (DataColumn col in dataset1.Tables["ClientTable"].Columns)
{
obj.Add(col.ColumnName, dr[col.ColumnName]);
}
clientProfile.Add(obj);
}
WebGrid grid = new WebGrid(clientProfile, rowsPerPage:10);
}
<div id="xyz">
@grid.GetHtml(tableStyle : "gridtable",
alternatingRowStyle: "altRow")
</div>
Well, that's it. Hope it's useful.