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
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
Thanks,
Ryan
Thanks,
Ryan
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
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
http://www.telerik.com/demos/aspnet/prometheus/Menu/Examples/Programming/DynamicCreation/DefaultCS.aspx