AJAX Navigation with Querystring Update

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

    Posted 13 Oct 2008 Link to this post

    I am trying to make my site fully AJAXified while still updating the querystring for search engine optimization purposes.

    Here is what I am trying

    ASPX.VB
        Private Sub RenderMenu()  
     
            AddStyleSheet("~/RadControls_CustomSkin/Menu.RadControls_CustomSkin.css")  
     
            Dim PagesDC As New Dal.icms_PagesDataContext()  
            Dim results = PagesDC.icms_Pages_GetPageMenu()  
     
            RadMenu1.Skin = "RadControls_CustomSkin" 
            RadMenu1.DataTextField = "MenuName" 
            RadMenu1.DataFieldID = "ID" 
            RadMenu1.DataFieldParentID = "ParentID" 
            RadMenu1.EnableEmbeddedSkins = False 
            RadMenu1.OnClientItemClicked = "SetID()" 
     
            RadMenu1.DataSource = results  
            RadMenu1.DataBind()  
     
        End Sub 
     
        Protected Sub RadMenu1_ItemClick(ByVal sender As ObjectByVal e As Telerik.Web.UI.RadMenuEventArgs) Handles RadMenu1.ItemClick  
            Dim HiddenID As HiddenField = DirectCast(Me.FindControl("HiddenID"), HiddenField)  
        End Sub 'RenderMenu  
     
        Protected Sub RadMenu1_ItemDataBound(ByVal sender As ObjectByVal e As Telerik.Web.UI.RadMenuEventArgs) Handles RadMenu1.ItemDataBound  
            e.Item.NavigateUrl = "#ID=" & CType(DataBinder.Eval(e.Item.DataItem, "ID"), String)  
        End Sub 'RadMenu1_ItemDataBound 


    ASPX
        <script type="text/javascript">  
            function SetID()  
            {  
                document.getElementById('<%= HiddenID.ClientID %>').value = window.location.hash;  
            }  
        </script> 
     
     
     
        <asp:HiddenField ID="HiddenID" runat="server" /> 

    The plan is to update the HiddenID via javascript and using RadAJAX in the RadMenu1_ItemClick event to poll the database and update an asp: Panel with the new DB information.

    anyone have any thoughts?
  2. Chase Florell
    Chase Florell avatar
    257 posts
    Member since:
    Apr 2005

    Posted 13 Oct 2008 Link to this post

    ALSO: I am basically trying to follow the instructions found Here

    and here is my Error:

    Line: 7
    Char: 29366
    Error: Object doesn't support this property or method
    Code: 0
    URL:***
  3. Chase Florell
    Chase Florell avatar
    257 posts
    Member since:
    Apr 2005

    Posted 13 Oct 2008 Link to this post

    another example would be to have both items in the menu <a> link so that the JavaScript enabled browsers get AJAX and non javascript browsers dont get AJAX.

    Example:
    <href="http://www.example.com/viewcontent.asp?id=401" onClick="return ajax_call(401)">Link</a> 

    anyone know how I might implement this alternative using RadAjax and RadMenu?
  4. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 14 Oct 2008 Link to this post

    Hello Chase Florell,

    You need to set the OnClientItemClicked event like this:

    RadMenu1.OnClientItemClicked = "SetID"

    Have in mind that RadMenu would navigate when you set the NavigateUrl property of the item. Navigation cannot be ajaxfied - only postbacks can.

    Regards,
    Albert
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top