Unable to cast object

Thread is closed for posting
2 posts, 0 answers
  1. Ratndeep
    Ratndeep avatar
    40 posts
    Member since:
    Feb 2009

    Posted 25 Jan 2010 Link to this post

    Hi ,
    I have Master-Child Table scenerion but there is a need to add master table primary id  into child table directly using child table field but when i do this getting following exception..

    Unable to cast object of type 'Open Access Runtime.Relational.Relational Generic OID' to type 'Telerik.OpenAccess.SPI.dataobjects.PersistenceCapable'.

    Plz Guide why its happening?
  2. Damyan Bogoev
    Damyan Bogoev avatar
    581 posts

    Posted 26 Jan 2010 Link to this post

    Hello Ratndeep,

    In fact you could use the “Presenting 1:n relations with hierarchical RadGrid and OpenAccess” Code Library example which is located here. In order to display the primary key of the master table you should add the following column inside the child table:

     <telerik:GridBoundColumn DataField="Company.CompanyId" DataType="System.Int32" HeaderText="CompanyId"
      ReadOnly="True" SortExpression="Company.CompanyId" UniqueName="Company.CompanyId">

    Hope that helps.

    Damyan Bogoev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top