By debugging my test application described before. I found out, that the scenario can be simplified as follows:
Create an ASP.NET project Add an SqlDataSource to Default.aspxSet the ConnectionString property to a valid network connection via an ODBC database driver Do not define the SelectCommand property In Page_Load enter the following code: DataView dv=(DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty); The application displays the infamous error page starting with „ExecuteReader: CommandText is not set.“ under Mono 2.10.5. Under .Net is simply displays an empty page. The Select() method returns null in this case. What we can conclude from this, is that the root cause of the problem is actually located somewhere inside SqlDataSource and it's dependencies and not part of the DataBound controls. I think SqlDataSourceView.ExecuteSelect() would be a good place to check for the SelectCommand property. If it's empty the method should simply return null. From: test051...@hotmail.com To: mono-aspnet-list@lists.ximian.com Date: Fri, 16 Sep 2011 13:44:30 +0000 Subject: Re: [Mono-aspnet-list] GridView/ Databinding bug in Mono 2.10.5 By inspecting/ debugging the class library I think there might be a problem in DataBoundControl.OnPagePreLoad() which calls DataBoundControl.Initialize(). The comment in the code says that the DataBoundControl.RequiresDataBinding property should be set to true in cases where the HTTP request is not a postback or it is a postback and view state is enabled but the data-bound control has not yet been bound. This is wrong because it does not consider the SelectCommand property of the SqlDataSource. If this property has not been defined, data binding must not take place. From: test051...@hotmail.com To: mono-aspnet-list@lists.ximian.com Date: Fri, 16 Sep 2011 13:34:37 +0000 Subject: [Mono-aspnet-list] GridView/ Databinding bug in Mono 2.10.5 Databinding in Mono is different compared to .Net Framework. I have observed this within a complex web application. Below you will find the steps to create a small example web app that demonstrates the issue: Create an ASP.NET project Add a GridView to Default.aspx Add an SqlDataSource to Default.aspx and connect it to the GridView Set the ConnectionString property to a valid network connection via an ODBC database driver Do not define the SelectCommand property Add an event handler SqlDataSource1_Selecting() which should be called whenever a databindung operation ocurrs. Put a breakpoint in SqlDataSource1_Selecting() to verify if databinding takes place If you run the application in Visual Studio, you will notice that SqlDataSource1_Selecting() is never called. But if you run the application in Mono 2.10.5 SqlDataSource1_Selecting() is called which will result in an exception because the SelectCommand property is actually not defined. It is common practice not to define the SelectCommand property within the .aspx file but rather calulate the actual query string within the code behind. Defineing the SelectCommand property within the .aspx file requires the use of ODBC parameters. However, Mono does currently not support this (see bug #694047 -> reported 4 months ago but not resolved yet). As a result we are forced to use the code behind method in Mono if we need to access a database via ODBC. Best regards,Martin _______________________________________________ Mono-aspnet-list mailing list Mono-aspnet-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-aspnet-list _______________________________________________ Mono-aspnet-list mailing list Mono-aspnet-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-aspnet-list
_______________________________________________ Mono-aspnet-list mailing list Mono-aspnet-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-aspnet-list
_______________________________________________ Mono-aspnet-list mailing list Mono-aspnet-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-aspnet-list