This is a migrated thread and some comments may be shown as answers.

AJAX Navigation with Querystring Update

3 Answers 74 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Chase Florell
Top achievements
Rank 1
Chase Florell asked on 13 Oct 2008, 09:21 PM
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?

3 Answers, 1 is accepted

Sort by
0
Chase Florell
Top achievements
Rank 1
answered on 13 Oct 2008, 09:24 PM
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:***
0
Chase Florell
Top achievements
Rank 1
answered on 14 Oct 2008, 01:34 AM
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?
0
Atanas Korchev
Telerik team
answered on 14 Oct 2008, 07:31 AM
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.
Tags
Menu
Asked by
Chase Florell
Top achievements
Rank 1
Answers by
Chase Florell
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or