Tuesday, June 17, 2008

Change default redirection in an ECB Menu

MOSS 2007 and Core.js File
Change default redirection in an ECB (Edit Control Block) Menu.

I am sure lots of people would be wondering how to Change default redirection in a ECB Menu items of a list eg On clicking the "Title Column hyperlink" or the ”View Item” in ECB(Edit Control Block) Menu, the redirection must be to a different location.

For this the modifications needs to be done in CORE.JS file located at "C:\Program Files\CommonFiles\MicrosoftShared\webserver extensions\12\TEMPLATE\LAYOUTS\1033\CORE.JS"


NOTE: Make sure you take back up of Core.js file before making any change in order to prevent any server functionality malfunction.


1) Clicking on Title Column hyperlink of a List Item
Default Sharepoint Navigation:
On clicking on the Title Column, SharePoint takes you to the DispForm.aspx page.

See below Image:


The default navigation is done by the function "GoToLink(elm)" present in core.js

Place alerts in the core.js and understand each of the parameters.
Eg. To navigate to a different page, assign the destination url to the targetUrl
String.


See below Image:




ECB(Edit Control Block) Menu Navigation.
2) Clicking on “View Item” of a List Item in the ECB menu
Default Navigation:
On clicking on the View Item in the ECB menu, SharePoint takes you to the DispForm.aspx page.

The default navigation is done using function “AddSharedNamespaceMenuItems(m, ctx)” in present in customcore.js

Place alerts in the core.js and understand each of the parameters.
Eg. To navigate to a different page, assign the destination url to the strAction
String.


Same as you did for the "Title Column hyperlink".

If you are confused....we kings are here...

No comments:




Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to sharepointkings@gmail.com with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!

If anyone would like to have their advertisement posted on this blog, please send us the requirement details to sharepointkings@gmail.com