Telerik RadMenu with multiple DataSourcesTelerik RadMenu from multiple DataSources

7 posts, 0 answers
  1. Ryan Pope
    Ryan Pope avatar
    61 posts
    Member since:
    Apr 2008

    Posted 21 Jul 2008 Link to this post

    Hello,

    I was wondering if you could provide me a walkthrough if it is possible to populate a RadMenu with multiple datasources. The parent from one table, a child from another table and another child level from another table. The tables are all linked by [category_id]

    Thanks,

    Ryan
  2. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 21 Jul 2008 Link to this post

    Hi Ryan Pope,

    We do not have such example for RadMenu, but we do have for RadTreeView. You can use it as a starting point and I am sure you will get the idea. Here is the link.

    Let us know if you face any problems.

    Best wishes,
    Veskoni
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Ryan Pope
    Ryan Pope avatar
    61 posts
    Member since:
    Apr 2008

    Posted 22 Jul 2008 Link to this post

    So i've been looking into it with that link you gave me, but i havn't gottten any furthur. I have found this link below showing how to add the items with Javascript, but I can't figure out how to reference this with VB.net and the radMenu (radProductMenu). Could you please help me figure out how to reference this code and get it to work for my menu?

    Thanks,
    Ryan
  4. Ryan Pope
    Ryan Pope avatar
    61 posts
    Member since:
    Apr 2008

    Posted 22 Jul 2008 Link to this post

    So i've been looking into it with that link you gave me, but i havn't gottten any furthur. I have found this link below showing how to add the items with Javascript, but I can't figure out how to reference this with VB.net and the radMenu (radProductMenu). Could you please help me figure out how to reference this code and get it to work for my menu?

    Thanks,
    Ryan
  5. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 22 Jul 2008 Link to this post

    Hello Ryan Pope,

    I don't think adding items from client-side will help you populate your menu from related data tables. The example we have referred to earlier describes a similar scenario. However you need to adapt it a bit to match your database schema. You need to modify the connection string, user SqlDataAdapter and SqlConnection instead of OldDb. Also you should change the select queries and the code which creates the DataRelation objects to match your database columns and relations.

    Regards,
    Albert
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Ryan Pope
    Ryan Pope avatar
    61 posts
    Member since:
    Apr 2008

    Posted 22 Jul 2008 Link to this post

    Okay, so i have set the relations and this is what i currently have. What would be the next step to filling a radMenu with these three different levels.


    Imports

    System.Data.SqlClient
    Imports System.Data
    Imports Telerik.WebControls

     Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    Dim connectionString As String = "server=localhost; Data Source=rdadevtest;Initial Catalog=RDAWebApps;Persist Security Info=True;User ID=aspweb;Password=rdadotdev;"

    Dim mySqlConnection As New SqlConnection(connectionString)
    Dim selectString As String = "SELECT * FROM Categories"

     Dim mySqlCommand As SqlCommand = mySqlConnection.CreateCommand()

    mySqlCommand.CommandText = selectString

    Dim mySqlDataAdapter As New SqlDataAdapter()

    mySqlDataAdapter.SelectCommand = mySqlCommand

    Dim myDataSet As New DataSet()

    mySqlConnection.Open()

    'Parent table
    mySqlDataAdapter.Fill(myDataSet, "Category")

    'First Child Table
    selectString = "SELECT * FROM Sub_Categories"
    mySqlCommand.CommandText = selectString
    mySqlDataAdapter.Fill(myDataSet,
    "SubCategory")

    'Second Child Table
    selectString = "SELECT * FROM Products"

     mySqlCommand.CommandText = selectString

    mySqlDataAdapter.Fill(myDataSet,

    "Products")

    myDataSet.Relations.Add(

    "ParentRelation", myDataSet.Tables("Category").Columns("category_id"), myDataSet.Tables("SubCategory").Columns("parent_category_id"))

    myDataSet.Relations.Add(

    "ChildRelation", myDataSet.Tables("SubCategory").Columns("sub_category_id"), myDataSet.Tables("Products").Columns("sub_category_id"))

    mySqlConnection.Close()

    End Sub

    End

    Class

    Thanks,
    Ryan

  7. Ryan Pope
    Ryan Pope avatar
    61 posts
    Member since:
    Apr 2008

    Posted 22 Jul 2008 Link to this post

    I have found a link that helped me fill the radMenu with my Parent, children and sub-children

    http://www.telerik.com/demos/aspnet/prometheus/Menu/Examples/Programming/DynamicCreation/DefaultCS.aspx
Back to Top