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

MenuItem onclick not firing

1 Answer 114 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Rich
Top achievements
Rank 1
Rich asked on 29 Nov 2012, 01:20 PM
I have a page where the user can change an address, and when they click Update, I need to run some javascript on the page to ask if they want to change some related addresses, THEN run the code on the server.

So on the .aspx page I have a javascript function:

 

 

 

function confirmAddressChange()
{
    if (document.forms[0].hfAddressChange.value =="")
    
     var res = (confirm('Update Contact Addresses to Match?')==true);
     document.forms[0].hfAddressChange.value = res;    
    }
    return true;
}

and on the RadMenuItem I have:  BTW, I've tried onClick, onItemClick, onclick and the one in the code now.

 

<rad:RadMenuItem ID="rmitmUpdateInfo" runat="server" ImageUrl="~/Images_ABL_Std/Grid/Update.gif"
    Text="Update" Value="update" ToolTip="Accept changes" OnClientItemClicking ="confirmAddressChange()">
</rad:RadMenuItem>

What I need to happen is to have the page run the javascript, where I set the value of a hidden field, then run the server code.  At this point it skips the javascript and goes directly to the server code.

Anyone have a suggestion or answer?

Thanks.

 

1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 04 Dec 2012, 01:22 PM
Hello,

Please keep in mind that only RadMenu control does provide a OnClientMenuItemClick event. You can try using the approach below in order to achieve the described functionality.
<telerik:RadMenu ID="RadMenu1" runat="server" OnClientItemClicked="confirmAddressChange">
    <Items>
        <telerik:RadMenuItem ID="rmitmUpdateInfo" runat="server" ImageUrl="~/Images_ABL_Std/Grid/Update.gif"
            Text="Update" Value="update" ToolTip="Accept changes">
        </telerik:RadMenuItem>
    </Items>
</telerik:RadMenu>


Regards,
Boyan Dimitrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Menu
Asked by
Rich
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or