Tuesday, May 8, 2012

Call Javascript from SharePoint Asp Menu

We had a particular situation where we needed to open a dialog box on the click of a menu item in the top SharePoint navigation.  If we have a normal link on the master page or layout page, we can call javascript like below:
But, when we try to enter the same in the SharePoint navigation, it gives us an error. 

In order to counter this, we found out a workaround.  There are some separate pages for quick launch and top nav as below:

1. Quick Launch:  http://'site url'/_layouts/quiklnch.aspx
2. Top link bar:  http://'site url'/_layouts/topnav.aspx

Here your can enter any kind of url.  We were able to open the page from our site in a dialog box.  The OpenDialog function we wrote in a js file and referenced in the master page. 

No comments:

Post a Comment