This is a migrated thread and some comments may be shown as answers.

BestPractice managing OA Context - Data Binding

3 Answers 70 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
John
Top achievements
Rank 2
John asked on 14 Feb 2012, 06:32 PM
I'm using VS2010, the latest ASP.net demo release, and the new sample project "ManagingOpenAccessContext".   I made changes to remove the references to an older ASP.net UI.  I can run the "BestPracticesMasterPageVB" and select the combo box and the grid data changes -- so all seems to be working.  I tried adding a new grid to the Default.aspx page and using the designer to try to bind it to the existing OpenAccessLinqDataSource1 --- it will not let me.  Looking at the design it appears the binding is being done in code directly to the DataLayerVB.  How do I use the BusinessLayerVB to bind to the data and can I use the designer to bind to a grid?  Will all of the features of the grid work (lazy loading, sorting, editing)? 

3 Answers, 1 is accepted

Sort by
0
John
Top achievements
Rank 2
answered on 15 Feb 2012, 03:56 PM
I created a new page based on the master and added a new ObjectDataSource for the Products.  The solution would build but not run due to some file update in the Debug folder..  So I switched it from debug to Release, re-built and open the new page.  I get the error below.  Anybody know how to fix this?

Server Error in '/' Application.
--------------------------------------------------------------------------------

Cannot convert value of parameter 'context' from 'System.String' to 'DataLayerVB.NorthwindContext'
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Cannot convert value of parameter 'context' from 'System.String' to 'DataLayerVB.NorthwindContext'

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace:

[InvalidOperationException: Cannot convert value of parameter 'context' from 'System.String' to 'DataLayerVB.NorthwindContext']
   System.Web.UI.WebControls.ObjectDataSourceView.ConvertType(Object value, Type type, String paramName) +234
   System.Web.UI.WebControls.ObjectDataSourceView.BuildObjectValue(Object value, Type destinationType, String paramName) +164
   System.Web.UI.WebControls.ObjectDataSourceView.GetResolvedMethodData(Type type, String methodName, IDictionary allParameters, DataSourceOperation operation) +647
   System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1263
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17
   Telerik.Web.UI.RadComboBox.OnDataBinding(EventArgs e) +627
   Telerik.Web.UI.RadComboBox.PerformSelect() +21
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +72
   Telerik.Web.UI.RadComboBox.DataBind() +39
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +72
   System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +22
   Telerik.Web.UI.RadDataBoundControl.OnPreRender(EventArgs e) +13
   Telerik.Web.UI.RadComboBox.OnPreRender(EventArgs e) +32
   System.Web.UI.Control.PreRenderRecursiveInternal() +150
   System.Web.UI.Control.PreRenderRecursiveInternal() +216
   System.Web.UI.Control.PreRenderRecursiveInternal() +216
   System.Web.UI.Control.PreRenderRecursiveInternal() +216
   System.Web.UI.Control.PreRenderRecursiveInternal() +216
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2837

 

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

0
Damyan Bogoev
Telerik team
answered on 16 Feb 2012, 04:40 PM

Hello John,

I have prepared a sample application, which demonstrates how to use ObjectDataSource with Telerik OpenAccess ORM.
I recommend you using the new OpenAccessLinqDataSource in order to achieve this scenario. Helpful demo application with it can be found in the Product SDK.
Hope that helps. If any other questions arise, do not hesitate to contact us back.

All the best,
Damyan Bogoev
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
John
Top achievements
Rank 2
answered on 16 Feb 2012, 05:51 PM
Thanks for the demo.  I got it to work and I am now reviewing it.
Tags
Getting Started
Asked by
John
Top achievements
Rank 2
Answers by
John
Top achievements
Rank 2
Damyan Bogoev
Telerik team
Share this question
or