[Mono-bugs] [Bug 76975][Wis] New - Can't add BoundColumn to DataGrid if no DataField specified

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Dec 13 04:48:41 EST 2005

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by dfreund at runlevel-5.org.


--- shadow/76975	2005-12-13 04:48:41.000000000 -0500
+++ shadow/76975.tmp.14317	2005-12-13 04:48:41.000000000 -0500
@@ -0,0 +1,80 @@
+Bug#: 76975
+Product: Mono: Class Libraries
+Version: 1.1
+OS: All
+OS Details: 
+Status: NEW   
+Priority: Wishlist
+Component: Sys.Web
+AssignedTo: gonzalo at ximian.com                            
+ReportedBy: dfreund at runlevel-5.org               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: Can't add BoundColumn to DataGrid if no DataField specified
+Description of Problem:
+It is not possible anymore to add BoundColumns to a DataGrid if the
+DataField is not specified. When omitting the DataField the following
+exception is exposed:
+System.ArgumentNullException: Argument cannot be null.
+Parameter name: expression
+This used to work in Mono before (again Mono <= 1.1.8 I guess). MS.NET also
+does not complain and adds empty cells. Due to the Microsoft documentation
+DataField is set to string.Empty by default.
+See example below. It displays two columns in MS.NET and in older Mono
+versions and fails with an exception on Mono 1.1.10
+Steps to reproduce the problem:
+1. create a DataGrid control and add any DataSource
+2. add a BoundColumn and _don't_ set a DataField
+Actual Results:
+Page execution fails with an exception
+Expected Results:
+Display of a DataGrid with the data of the DataSource plus an empty column
+How often does this happen? 
+every time
+Additional Information:
+Test ASP page that fails with an exception
+<%@ Page EnableViewState="true" Language="C#" %>
+<script language="C#" runat="server">
+public void Page_Load(object sender, EventArgs e) {
+	ArrayList data = new ArrayList();
+	data.Add("one");
+	data.Add("two");
+        // create a column with 2 entries
+	dataGrid.DataSource = data;
+        // this should add an empty column
+	BoundColumn bc = new BoundColumn();
+        bc.HeaderText = "Empty";
+	dataGrid.Columns.Add(bc);
+	dataGrid.DataBind();
+	<title>Test</title>
+<form runat="server">
+	<asp:DataGrid id="dataGrid" runat="server"/>

More information about the mono-bugs mailing list