[Mono-list] DataGrid difference to .NET

winzen at online.de winzen at online.de
Mon Feb 20 09:59:29 EST 2006

Hi everybody,

i'm using DataGrids with dynamic DataTables in an ASP.NET application. I encountered a small problem when DataGrids show different behaviour in Mono compared to MS.NET (bug on MS side?). When i bind a DataTable with strange column names (including special characters like ".") to a DataGrid Mono throws an exception and MS.NET does not.

Here is a small NUnit test to demonstrate the problem:

public void DataGridWithStrangeColumnNames() {
  DataTable testTable = createTable(new string[] {"test / 5x",
    "eps.mul(%)", "yearX", "jahr_2000"});
  testTable.Rows.Add(new object[] {"EPS adj.test", "47", "0", "a"});
  DataGrid grid = new DataGrid();
  grid.AutoGenerateColumns = true;
  grid.DataSource = testTable;

private DataTable createTable(string[] fields) {
  DataTable table = new DataTable();
  foreach (string column in fields) {
  return table;

Jochen Winzen

P.S. This is the error message:

OS Version: Unix    Mono Version: 1.1.4322.2032

Tests run: 64, Failures: 1, Not run: 0, Time: 4.182289 seconds

1) TestFacade.DataGridWithStrangeColumnNames : System.Web.HttpException : Property eps not found in System.Data.DataRowView
in <0x0015a> System.Web.UI.DataBinder:GetPropertyValue (System.Object container, System.String propName)
in <0x000ac> System.Web.UI.DataBinder:Eval (System.Object container, System.String expression)
in <0x0005b> System.Web.UI.WebControls.BoundColumn:GetValueFromItem (System.Web.UI.WebControls.DataGridItem item)
in <0x0006e> System.Web.UI.WebControls.BoundColumn:ItemDataBinding (System.Object sender, System.EventArgs e)
in (wrapper delegate-invoke) System.MulticastDelegate:invoke_void_object_EventArgs (object,System.EventArgs)
in <0x00117> System.Web.UI.Control:OnDataBinding (System.EventArgs e)
in <0x00013> System.Web.UI.Control:DataBind ()
in <0x0005a> System.Web.UI.Control:DataBindChildren ()
in <0x0001e> System.Web.UI.Control:DataBind ()
in <0x0010b> System.Web.UI.WebControls.DataGrid:CreateItem (Int32 item_index, Int32 data_source_index, ListItemType type, Boolean data_bind, System.Object data_item, System.Web.UI.WebControls.PagedDataSource paged)
in <0x00420> System.Web.UI.WebControls.DataGrid:CreateControlHierarchy (Boolean useDataSource)
in <0x00095> System.Web.UI.WebControls.BaseDataList:DataBind ()
in <0x0013c> Mescor.WebCliver.BusinessModel.Company.TestCompanyFacade:DataGridWithStrangeColumnNames ()
in <0x00000> <unknown method>
in (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[])
in <0x0008d> System.Reflection.MonoMethod:Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)

More information about the Mono-list mailing list