Radmenuitem call function inside navigateurl ?

2 posts, 0 answers
  1. David Blok
    David Blok avatar
    42 posts
    Member since:
    Nov 2009

    Posted 08 Dec 2009 Link to this post

    How can i call a function inside the navigate url property ?

    Below is the code:
    Im trying to call a function with function.getpageid inside the navigateurl.

    <script language="javascript" type="text/javascript">  
        function onClicking(sender, eventArgs) {  
            var item = eventArgs.get_item();  
            var navigateUrl = item.get_navigateUrl();  
            eventArgs.set_cancel(true);  
            if (navigateUrl && navigateUrl != "#") {  
                var oWnd = radopen(navigateUrl, "WindowName");  
            }  
            sender.hide();  
        }    
    </script>  
       
            <telerik:RadContextMenu ID="RadContextMenu2" runat="server" OnClientItemClicking="onClicking">        
            <Targets>       
                <telerik:ContextMenuControlTarget ControlID="Mediaarea" />  
            </Targets>       
            <Items>       
                <telerik:RadMenuItem runat="server" Text="Media wijzigen" NavigateUrl='~/test.aspx?PageID=<%# functions.getpageID %>'></telerik:RadMenuItem>     
            </Items>       
            </telerik:RadContextMenu>           
            <telerik:RadWindowManager ID="RadWindowManager1" runat="server">        
            </telerik:RadWindowManager>    
     
    <div id="Mediaarea">  
    <img src="Upload/Design/GUI/images/powerplusxq/media.jpg" />  
    </div>  
     

    But i get result as PageID=%3C%

    anyone has a suggestion ?
  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 08 Dec 2009 Link to this post

    Hello David,

    This issue is not directly related to RadWindow or RadMenu. The problem here is the incorrect usage of the data binding syntax. More information on the subject is available in varous resources in the Net - for exampl you could check this MS article - http://support.microsoft.com/kb/307860

    In your case I would suggest to set the NavigateUrl property of the menu directly on the server - this way you will avoid the problem that you currently experience. Another way to do this is to output the server variable in a hidden field and read that field in your JavaScript code.

     


    Sincerely yours,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top