ASP.NET Slide Menu - Knowledge Base

« Back to Knowledge Base list

How to add set OnClientClick event for SlideMenu item in code-behind?

Q:

How to add set OnClientClick event for SlideMenu item in code-behind?

A:

If you have problem of how to set OnClientClick for SlideMenu item in code-behind because of no OnClientClick parameter in the AddChild method, you may use following solution:

            osm.AddChild("a_d", "Downloads");
            osm.MenuItems[osm.MenuItems.Count - 1].OnClientClick = "alert(1);";

This will add the OnClientClick event to Downloads childitem.