javascript - How do you call an onClick event from a MenuItem in ASP.NET? - Stack Overflow

How do you call an onclick event from MenuItem since there is no OnClick property for MenuItem in ASP.N

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.

Share edited Jul 9, 2012 at 13:55 LittleBobbyTables - Au Revoir 32.8k25 gold badges111 silver badges115 bronze badges asked Jul 9, 2012 at 13:46 LearnerLearner 431 gold badge2 silver badges10 bronze badges 5
  • @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
Add a ment  | 

2 Answers 2

Reset to default 1

Menu 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条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信