OpenAccessDataSource

Thread is closed for posting
3 posts, 0 answers
  1. 63F75A2C-1F16-4AED-AFE8-B1BBD57646AD
    63F75A2C-1F16-4AED-AFE8-B1BBD57646AD avatar
    1572 posts
    Member since:
    Oct 2004

    Posted 29 Jul 2009 Link to this post

    Requirements

    RadControls version

    2009.1.402.35
    .NET version

    3.5
    Visual Studio version

    2008
    programming language

    C#
    browser support

    all browsers supported by RadControls


    PROJECT DESCRIPTION
    The attached project presents some advanced  scenarios of using the OpenAccesDataSource web-component like defining properties dynamically and responding to datasource events.
  2. 9A6A2C2B-EE6E-49DB-9B74-F32149F0D3C8
    9A6A2C2B-EE6E-49DB-9B74-F32149F0D3C8 avatar
    16 posts
    Member since:
    May 2008

    Posted 08 Dec 2010 Link to this post

    I was hoping this project would help me understand how to programmatically configure an OpenAccessDataSource on Selecting. But Selecting is not handled. Is there and example I could use somewhere else. Would be more useful if it has the latest ORM release for .Net 4.0 and VS 2010. But just need to understand some concepts. i use to be able to use something like this with a LinqDataSource:

    e.result = from x in dbContext.Orders where x.id == _id select x;

    I was expecting something similar with OpenAccessDataSource - but no luck so far.
  3. DF306142-48B5-44E4-8E2D-C52759157F15
    DF306142-48B5-44E4-8E2D-C52759157F15 avatar
    581 posts
    Member since:
    Mar 2017

    Posted 14 Dec 2010 Link to this post

    Hello Bruno,

    Firstly I want to thank you for the valuable input.
    You should use the OpenAccessDataSource.CommandText property which enables you to specify a custom OQL query. But in this case you will not be able to perform create, delete and update operations through the control.
    What you should do is to provide an event handler for the OpenAccessDataSource.Selecting event and specify the OQL statement there:

    <telerik:OpenAccessDataSource ID="OpenAccessDataSource1" runat="server"
    ObjectContextProvider="WebApplication.NorthwindContext, WebApplication"
    EnableDelete="false" EnableInsert="false" EnableUpdate="false" />

    protected void Page_Init(object sender, EventArgs e)
    {
        ...
        this.OpenAccessDataSource1.Selecting += new EventHandler<Telerik.OpenAccess.OpenAccessDataSourceSelectingEventArgs>(OpenAccessDataSource1_Selecting);
        ...
    }
     
    protected void OpenAccessDataSource1_Selecting(object sender, Telerik.OpenAccess.OpenAccessDataSourceSelectingEventArgs e)
    {
        ...
        this.OpenAccessDataSource1.CommandText = string.Format("select o from OrderExtent as o where o.id == {0}", _id);
    }

    Hope that helps.

    All the best,
    Damyan Bogoev
    the Telerik team
    Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.