How do you call an onclick
event from MenuItem
since there is no OnClick
property for MenuItem
in ASP.NET?
Using NavigateUrl
we can navaigate to a particular url but once I click on MenuItem
it should trigger an event.
How do you call an onclick
event from MenuItem
since there is no OnClick
property for MenuItem
in ASP.NET?
Using NavigateUrl
we can navaigate to a particular url but once I click on MenuItem
it should trigger an event.
- @akhil: Does it have answer for the question – Learner Commented Jul 9, 2012 at 13:58
- 2 Don't understand why this question has a downvote total of -2, it seems perfectly valid to me. – to StackOverflow Commented Jul 9, 2012 at 13:59
- 2 15 seconds of google, less time that it took you to post the question: msdn.microsoft./en-us/library/… – jbabey Commented Jul 9, 2012 at 14:05
- @jbabey: I have gone through the same link before posting the question and I have tried it out but it's not working. I need for MenuItem and not for Menu – Learner Commented Jul 9, 2012 at 14:12
- @Viswa if you read the documentation you'd see that you get which menu item was clicked through the one generic event. what you are asking for does not (and should not) exist, as it is a subset of the functionality that already exists. – jbabey Commented Jul 9, 2012 at 14:13
2 Answers
Reset to default 1Menu has MenuItem.MenuItemClick
event, you can use that to do whatever you wanted with onclick
.
You can use the Menu.MenuItemClick
event of the Menu that contains your menu item:
http://msdn.microsoft./en-us/library/system.web.ui.webcontrols.menu.menuitemclick.aspx
<asp:Menu runat="server" ID="MyMenu" onmenuitemclick="MyMenu_MenuItemClick" ... >
...
</asp:Menu>
Clicking on any menu item that does not have the NavigateUrl
property set will cause the page to be postback and the Menu.MenuItemClick
event handler to be executed.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745067589a4609346.html
评论列表(0条)