BestPractice managing OA Context - Data Binding

4 posts, 0 answers
  1. John
    John avatar
    12 posts
    Member since:
    Jul 2006

    Posted 14 Feb 2012 Link to this post

    I'm using VS2010, the latest demo release, and the new sample project "ManagingOpenAccessContext".   I made changes to remove the references to an older 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)? 
  2. John
    John avatar
    12 posts
    Member since:
    Jul 2006

    Posted 15 Feb 2012 Link to this post

    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

  3. DevCraft banner
  4. Damyan Bogoev
    Damyan Bogoev avatar
    581 posts

    Posted 16 Feb 2012 Link to this post

    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 >>
  5. John
    John avatar
    12 posts
    Member since:
    Jul 2006

    Posted 16 Feb 2012 Link to this post

    Thanks for the demo.  I got it to work and I am now reviewing it.
Back to Top