Multi-Table DataSet

2 posts, 0 answers
  1. RSI
    RSI avatar
    78 posts
    Member since:
    Nov 2011

    Posted 18 Jun 2012 Link to this post

    Hello Telerik,

    According to the documentation the RadTabStrip should be able to bind to a dataset correct? I cant seem to get it to work correctly.

    Dim myDataSet As New DataSet()
    Dim table As New DataTable("ParentTbl")
    Dim table1 As New DataTable("ChildTbl")
    table.Rows.Add(New String() {"1", "root 1"})
    table.Rows.Add(New String() {"2", "root 2"})
    table.Rows.Add(New String() {"3", "root 3"})
    table.Rows.Add(New String() {"4", "root 4"})
    table1.Rows.Add(New String() {"1", "1", "child 1"})
    table1.Rows.Add(New String() {"2", "1", "child 11"})
    table1.Rows.Add(New String() {"3", "2", "child 2"})
    table1.Rows.Add(New String() {"4", "2", "child 22"})
    table1.Rows.Add(New String() {"5", "2", "child 23"})
    table1.Rows.Add(New String() {"6", "3", "child 3"})
    table1.Rows.Add(New String() {"7", "4", "child 4"})
    table1.Rows.Add(New String() {"8", "4", "child 42"})
    myDataSet.Tables.AddRange(New DataTable() {table, table1})
    Dim myParentColumn As DataColumn = myDataSet.Tables(0).Columns("ParentId")
    Dim myChildColumn As DataColumn = myDataSet.Tables(1).Columns("ParentId")
    Dim myDataRelations As New DataRelation("myDataRelation", myParentColumn, myChildColumn)
    Me.RadTabStripReports.DataFieldParentID = "ParentId"
    Me.RadTabStripReports.DataFieldID = "ChildId"
    ' Set Text, Value
    Me.RadTabStripReports.DataTextField = "Name"
    Me.RadTabStripReports.DataValueField = "ChildId"
    Me.RadTabStripReports.DataSource = myDataSet

    When I test the TabStrip with this code it blows out with an error on the DataBind line.

    Columns specified by DataFieldID/DataFieldParenID not found. Is this because of multiple tables in the dataset? The sample you show only has 1 datatable in the dataset. I can debug it and see the columns do in fact exist in the dataset tables.

    Can you supply a sample that works with multiple tables, or is there something else that needs to be done?

  2. Dimitar Terziev
    Dimitar Terziev avatar
    1266 posts

    Posted 21 Jun 2012 Link to this post


    The hierarchical binding of the RadTabStrip is supported in scenarios with self-referencing hierarchy in a single table. In scenario with multiple tables the hierarchy should be build manually by first creating the parent items and then adding their children.

    Dimitar Terziev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. DevCraft R3 2016 release webinar banner
Back to Top