Hi,
I'm struggling to find a way to add items to the second level of an existing RadMenu coded in ASP using my VB. I know I can create the whole menu in VB but i really don't want to go through all that trouble if there is a better way.
My ASP looks like this:
I'm struggling to find a way to add items to the second level of an existing RadMenu coded in ASP using my VB. I know I can create the whole menu in VB but i really don't want to go through all that trouble if there is a better way.
My ASP looks like this:
<telerik:RadMenu runat="server" ID="radmenu1" Skin="Sunset" EnableEmbeddedSkins="false" Width="895px"> |
<Items> |
<telerik:RadMenuItem Text="HOME" NavigateUrl="~/" /> |
<telerik:RadMenuItem Text="LINK2" NavigateUrl="~/Link1.aspx" /> |
<telerik:RadMenuItem Text="LINK4"> |
<Items> |
<telerik:RadMenuItem Text="LINK4.1" NavigateUrl="~/Link4.1" /> |
<telerik:RadMenuItem Text="LINK4.2" NavigateUrl="~/Link4.2" /> |
<telerik:RadMenuItem Text="LINK4.3"/> |
<%--THIS IS WHERE I WANT TO ADD ITEMS--%> |
</Items> |
</telerik:RadMenuItem> |
<telerik:RadMenuItem Text="LINK5" Visible="true" NavigateUrl="~/Link5.aspx" /> |
</Items> |
</telerik:RadMenu> |
And my VB:
Dim sConStr As String = ConfigurationManager.ConnectionString("MyConnectionString").ConnectionString |
Dim sSQL As String = "" |
Dim cm As SqlCommand |
sSQL = "SELECT Text, ID, FROM Table " |
cm = New SqlCommand(sSQL, New SqlConnection(sConStr)) |
cm.Connection.Open() |
dr = cm.ExecuteReader |
Dim oRadMenuItem As New RadMenuItem |
Do While dr.Read |
oRadMenuItem = New RadMenuItem |
oRadMenuItem.Text = dr("Name") |
oRadMenuItem.NavigateUrl = "TARGETLINK?id=" & dr("ID") |
radmenu1.Items(4).Items(4).Items.Add(oRadMenuItem) |
Loop |
cm.Connection.Close() |
Clearly this is not the way to do this. Any help will be greatly appreciated.