RadMenu for ASP.NET

Define the structure programmatically Send comments on this topic.
See Also
Defining the Telerik RadMenu structure > Define the structure programmatically

Glossary Item Box

Using the server-side API, you can programmatically add, remove, and edit items in Telerik RadMenu.  

Below is the code used to programmatically build a menu with three items:

C# Copy Code
protected Telerik.WebControls.RadMenu RadMenu1;

protected void Page_Load(object sender, EventArgs e)
{
   
if (!Page.IsPostBack)
   {
       RadMenuItem item1 =
new RadMenuItem();
       item1.Text =
"Item 1";
       RadMenuItem item2 =
new RadMenuItem();
       item2.Text =
"Item 2";
       RadMenuItem item3 =
new RadMenuItem();
       item3.Text =
"Go to the Telerik site";
       item3.NavigateUrl =
"http://www.telerik.com";
       RadMenu1.Items.Add(item1);
       RadMenu1.Items.Add(item2);
       RadMenu1.Items.Add(item3);
   }
}
        
VB.NET Copy Code
Dim RadMenu1 As Telerik.WebControls.RadMenu

    Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        If Not Page.IsPostBack Then
            Dim item1 As RadMenuItem = New RadMenuItem
            item1.Text = "Item 1"
            Dim item2 As RadMenuItem = New RadMenuItem
            item2.Text = "Item 2"
            Dim item3 As RadMenuItem = New RadMenuItem
            item3.Text = "Go to the Telerik site"
            item3.NavigateUrl = "http://www.telerik.com"
            RadMenu1.Items.Add(item1)
            RadMenu1.Items.Add(item2)
            RadMenu1.Items.Add(item3)
        End If
    End Sub

 

See Also