[Mono-list] DataGrid difference to .NET
Mike
stuff at dustsmoke.com
Tue Feb 21 03:47:51 EST 2006
winzen at online.de wrote:
> 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:
>
> [Test]
> 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;
> grid.DataBind();
> }
>
> private DataTable createTable(string[] fields) {
> DataTable table = new DataTable();
> foreach (string column in fields) {
> table.Columns.Add(column);
> }
> return table;
> }
>
> CU
> Jochen Winzen
>
> P.S. This is the error message:
>
> OS Version: Unix 2.6.8.2 Mono Version: 1.1.4322.2032
>
> .......................................F.........................
> Tests run: 64, Failures: 1, Not run: 0, Time: 4.182289 seconds
>
> Failures:
> 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)
> _______________________________________________
>
Ackkkk!
Why on earth would you want to do this in the first place? You are just
asking for trouble.
But no, it isn't a bug on MS's side. Its just some very bad form that
they have been accepting for as long as I can remember with their products.
-Mike
More information about the Mono-list
mailing list