This is a migrated thread and some comments may be shown as answers.

Telerik RadMenu with multiple DataSourcesTelerik RadMenu from multiple DataSources

6 Answers 88 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Ryan Pope
Top achievements
Rank 1
Ryan Pope asked on 21 Jul 2008, 03:41 PM
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

6 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 21 Jul 2008, 03:55 PM
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
0
Ryan Pope
Top achievements
Rank 1
answered on 22 Jul 2008, 02:09 PM
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
0
Ryan Pope
Top achievements
Rank 1
answered on 22 Jul 2008, 02:09 PM
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
0
Atanas Korchev
Telerik team
answered on 22 Jul 2008, 02:27 PM
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
0
Ryan Pope
Top achievements
Rank 1
answered on 22 Jul 2008, 04:28 PM

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

0
Ryan Pope
Top achievements
Rank 1
answered on 22 Jul 2008, 08:05 PM
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
Tags
Menu
Asked by
Ryan Pope
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Ryan Pope
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or