3 posts, 0 answers
  1. Telerik Admin
    Telerik Admin avatar
    1679 posts
    Member since:
    Oct 2004

    Posted 29 Jul 2009 Link to this post


    RadControls version

    .NET version

    Visual Studio version

    programming language

    browser support

    all browsers supported by RadControls

    The attached project presents some advanced  scenarios of using the OpenAccesDataSource web-component like defining properties dynamically and responding to datasource events.
  2. Bruno
    Bruno 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 == _id select x;

    I was expecting something similar with OpenAccessDataSource - but no luck so far.
  3. Damyan Bogoev
    Damyan Bogoev avatar
    581 posts

    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 == {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