Share the Objectdatasource in Multi Table

4 posts, 1 answers
  1. A.p.kumar
    A.p.kumar avatar
    8 posts
    Member since:
    Oct 2015

    Posted 02 Aug Link to this post

    i have ( list of Table1 ( list of Table2(  list of tables3)).

    Ex:    List of A  is hierarchy of List of B , And B is hierarchy of List C.( like parent , Child, grand Children)

    In below table Picture , Each Row of Table 1 has Table 2. And Each row of Table2 has  Table 3. Totally one object data source share three table ..

    3 question --

    1.how to set the data Source, inside the table .

    2. i tried the binding property of Table 2 , set the data source using Edit bindings data Source  = Field.listotTable2,  But i can't set the Table3 ...

    3. in table2 the data source is bind data Source. But i can't access the member of listofTable2 Class..

  2. Katia
    Admin
    Katia avatar
    307 posts

    Posted 04 Aug Link to this post

    Hi,

    Test using ReportItem.Parent.Parent.DataObject to set the DataSource property, where the parent key word can be used as many times as needed to reach to the parent element.

    Also, check the approach suggested in How to Databind to Collection Properties kb article to see if it can help in your scenario.


    If you need further help please attach a sample report with test data in a support ticket so we can understand the scenario more clearly and give you more accurate suggestions.

    Regards,
    Katia
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
  4. A.p.kumar
    A.p.kumar avatar
    8 posts
    Member since:
    Oct 2015

    Posted 05 Aug Link to this post

    Hi katia,

    According to the Code ,

    objectdatsource1  =  readDB , Datamember = p_listofclass

    table1  datasource = objectdatsource1

    table2 datasoure = Field.p_listC; ( using Binding )

    how to fix below probelm

       table2 - >  row testbox1 = ???    (  i want  use  field .p_name in the Textbox , how to do ?)

      table3 datasource = ???  ( i want to use Field .p_listofD)

        table3 -> row textbox1= ??? ( Field.p_mbr )

     

    public class readDB
     
    private mlistofclass As New list(of ClassB)
     
    public New()
     
    While data.read                           ---------------> OLEDB read (Access database )
        mlistofclass.Add( new ClassB( data.item(4))
    end While
     
     
    public Readonly property p_listofclass As List(of ClassB)----------> datasource datamember
      Get
          return mlistofclass
      End Get
    End property
     
    End Sub
     
    End class
    ------------------------------------------------------------------------
     
    public Class ClassB
     
    private m_Name As String
    private m_listofclassC As new List(of classC)
     
    public Sub new(BYval Str1 As String )
      m_Name= Str1.Split("\").last
         For i As integer = 0 to Str1.SPlit("\").Count -1
             listofclassC.Add( New classC(Str1.Split("\").Toarry(i))
         next
     
    End sub()
     
    public Readonly property  p_listC As List(of classC)
      Get
         Return listofclassC
      End Get
    End Property
     
    public Readonly property  p_name As String
      Get
          return
      End Get
    End property
     
    End class
     
    ------------------------------------------------------------------------------
     
    public Class classC
     
      private m_listofcalssD A new List(of ClassD)
      private m_Rname As String
     
      public Sub new( BYval Str2 As String )
         
       m_Rname = Str2.Split("?").last
        For j As Integer = 0 to Str2.Split("?").Count -1
           listofcalssD.Add( new ClassD( Str2.Split("?").ToArray(j)))
        Next
     
      End Sub
         
     
    public property Readonly p_listofD As List(of ClassD)
     Get
         return listofcalssD
    End Get
    End property
    End Class
     
    .............................
     
    public Class ClassD
     
    private m_mber As String
     
    public property Readonly p_mbr As String
     Get
       Return m_mber
     End Get
    End property
     
    End Sub

  5. Answer
    Katia
    Admin
    Katia avatar
    307 posts

    Posted 09 Aug Link to this post

    Hi,

    If you bind the DataSource of table2 to p_listC which is a list of ClassC objects, the field p_name will not be accessible within the table2 as ClassC does not have such member.
    To access the property p_name the table needs to be bound to al list of ClassB objects as p_name is a member of ClassB.

    Table3 DataSource can be bound to p_listofD using bindings as it is a member of ClassC and the parent table has a collection of ClassC objects as a DataSource. Property p_mbr will also be accessible within table3 as it is a member of ClassD.

    Note, that when you set the DataSource property with bindings the data fields are not visible in Edit Expression dialog and you need to type them in manually.


    Regards,
    Katia
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top