0

I'm trying to add a basic link below my Calendar page without using any web parts. I noticed that when adding another web part to the Calendar page, the view dropdown in the browse tab ribbon UI disappears. I'd like to keep the view options and add a link below the calendar. Any methods to accomplish this?

0

You could have a Custom Action that has a ScriptSrc or ScriptBlock that would run on every page in the SPWeb. The script could look at the URL and decide to add DOM elements for only specific pages. With this approach your javascript would have to know how to find the page(s) based on the URL (pretty easy) and would have to know the markup well enough on those pages to know where to add DOM elements.

  • Would I upload a script file to SharePoint and reference it in the .aspx view of the calendar? – nuk11888 Nov 14 '13 at 18:17
  • The script must go in layouts (ScriptSrc) or be inline in the CustomAction xml (ScriptBlock). Here is a blog that describes this a little: spdeveloper.co.in/tipsntricks/pages/… – Kirk Liemohn Nov 15 '13 at 20:05
0

I found the solution.

Go to the list view .aspx file and go to line 12 which has

<SharePoint:ListTitleViewSelectorMenu AlignToParent="true" id="LTViewSelectorMenu" runat="server" />

Replace with this code

<SPAN id=onetidPageTitleSeparator><SPAN><SPAN style="POSITION: relative; WIDTH: 11px; DISPLAY: inline-block; HEIGHT: 11px; OVERFLOW: hidden"><IMG style="POSITION: absolute; BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; TOP: -585px !important; LEFT: 0px !important" alt=: src="/_layouts/images/fgimg.png"></SPAN></SPAN></SPAN>
<SharePoint:ViewSelectorMenu ID="viewSelectorMenu1" runat="server" />

It should show the view dropdown even with a content editor web part.

0

One of the solution can be that you could use delegate control to render javascript on the Calendar page.

You could either use ClientScriptManager to register it or can use Controls also

Ex:

ClientScriptManager clientScript = this.Page.ClientScript;
clientScript.RegisterClientScriptBlock(this.GetType(), "key", "script");

or

Controls.Add(new LiteralControl(@"script");

Use the following js script to add the link.

$('#AsynchronousViewDefault_CalendarView').append("<div><a href=''>your link</a></div>");
  • Would this require Visual Studios? I only have designer access and SharePoint Designer to work with. If not, would I go to "default view".aspx of the Calendar to add the script? – nuk11888 Nov 14 '13 at 18:11
  • yes...its requires VS..but u are correct u can do it using designer. – Pushpendra Nov 14 '13 at 18:17
  • Could you give me an example of injecting the Controls.Add in the "view".aspx? Would it be right after the Calendar webpart </WebPartPages:ListViewWebPart>? Would I use a <p>Controls...</p>? How would I reference the JS? – nuk11888 Nov 14 '13 at 19:28
  • dcsharepointchick.blogspot.in/2012/10/… have a look at this. – Pushpendra Nov 14 '13 at 19:45
  • But it looks like to implement a Delegate Control, I need Visual Studios which I don't have/know how to use. Is there no way to just slap on a link in a specific calendar web part at the bottom? – nuk11888 Nov 14 '13 at 19:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.