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

Radmenuitem call function inside navigateurl ?

1 Answer 296 Views
Window
This is a migrated thread and some comments may be shown as answers.
David Blok
Top achievements
Rank 1
David Blok asked on 08 Dec 2009, 10:04 AM

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 ?

1 Answer, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 08 Dec 2009, 12:45 PM
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.
Tags
Window
Asked by
David Blok
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Share this question
or