RadMenu and DB Navigation

2 posts, 0 answers
  1. Chase Florell
    Chase Florell avatar
    257 posts
    Member since:
    Apr 2005

    Posted 09 Sep 2008 Link to this post

    This seems like a simple problem but I am not getting it.

    I need my menu to bind to a DB and navigate as follows.

    www.mysite.com/Default.aspx?ID=[DatabaseID]

    If I use
    RadMenu1.DataNavigateUrlField = "ID"
    Then it navigates as follows
    www.mysite.com/[DatabaseID]

    If I use
    RadMenu1.PostBackURL = "Default.aspx?ID="
    Then I dont get the ID at the end... Where have I gone wrong?

        Private Sub RenderMenu()  
            If Not Page.IsPostBack Then 
     
                Dim PagesDC As New Dal.icms_PagesDataContext()  
                Dim results = From r In PagesDC.icms_Pages_GetPageMenu _  
                              Select r  
     
                RadMenu1.DataTextField = "MenuName" 
                RadMenu1.DataFieldID = "ID" 
                RadMenu1.DataFieldParentID = "ParentID" 
                RadMenu1.DataNavigateUrlField = "" 
     
                RadMenu1.DataSource = results  
                RadMenu1.DataBind()  
     
            End If 
        End Sub 
  2. Chase Florell
    Chase Florell avatar
    257 posts
    Member since:
    Apr 2005

    Posted 09 Sep 2008 Link to this post

    Evidently this is the way to do the above mentioned.

        Private Sub RenderMenu()  
            If Not Page.IsPostBack Then 
     
                Dim PagesDC As New Dal.icms_PagesDataContext()  
                Dim results = PagesDC.icms_Pages_GetPageMenu()  
     
                RadMenu1.DataTextField = "MenuName" 
                RadMenu1.DataFieldID = "ID" 
                RadMenu1.DataFieldParentID = "ParentID" 
     
                RadMenu1.DataSource = results  
                RadMenu1.DataBind()  
     
            End If 
        End Sub 
     
        Protected Sub RadMenu1_ItemDataBound(ByVal sender As ObjectByVal e As Telerik.Web.UI.RadMenuEventArgs) Handles RadMenu1.ItemDataBound  
            e.Item.NavigateUrl = "~/Default.aspx?ID=" & CType(DataBinder.Eval(e.Item.DataItem, "ID"), String).ToString  
        End Sub 
Back to Top