Sharepoint master page asp:repeater tag - sharepoint

I am currently working on generating a master page for a sharepoint instance. It is however giving some issues when attempting to convert over an ASP repeater
The following works in generating a repeated text:
<!--MS:<asp:Repeater ID="TopMenu" runat="server" DataSourceID="selectedSiteMap">-->
<!--MS:<HeaderTemplate> -->
<!--ME:</HeaderTemplate> -->
<!--MS:<ItemTemplate> -->
<li>test</li>
<!--ME:</ItemTemplate> -->
<!--MS:<FooterTemplate> -->
<!--ME:</FooterTemplate> -->
<!--ME:</asp:Repeater> -->
<!--MS:<asp:SiteMapDataSource SiteMapProvider="CurrentNavigation" ShowStartingNode="false"
StartFromCurrentNode="false" StartingNodeOffset="0" StartingNodeUrl="sid:1002"
EnableViewState="true" ID="selectedSiteMap" runat="server" /> -->
However the following does not work:
<!--MS:<asp:Repeater ID="TopMenu" runat="server" DataSourceID="selectedSiteMap">-->
<!--MS:<HeaderTemplate> -->
<ul id="main_menu_ul" class="">
<!--ME:</HeaderTemplate> -->
<!--MS:<ItemTemplate> -->
<li><a href=<!--MS:"<%# Eval("Url")%>"--> class="link">
<!--MS:<%# Eval("Title")%>--></a></li>
<!--ME:</ItemTemplate> -->
<!--MS:<FooterTemplate> -->
</ul>
<!--ME:</FooterTemplate> -->
<!--ME:</asp:Repeater> -->
<!--MS:<asp:SiteMapDataSource SiteMapProvider="CurrentNavigation" ShowStartingNode="false"
StartFromCurrentNode="false" StartingNodeOffset="0" StartingNodeUrl="sid:1002"
EnableViewState="true" ID="selectedSiteMap" runat="server" /> -->
So far I have identified the issue is 2 fold:
1. the converter is does not like the fact that the opening ul and closing ul dont exactly match
2. the converter does not like the eval tags at all.
Any help anyone could give to getting this repeater to work properly would be very helpful. Thank you

The other possibility is that you are manually uploading your master page (as opposed to deploying it using a feature). The <%# Eval("Url")%> tag is seen as server-side code, and it turns out that there is a security limitation that server-side code is not allowed in customized pages - in other words, ones that are unghosted.
So if you customize a master page using SharePoint designer, the new copy exists in the content database, and this is regarded as customized.
I hit this recently - deployed an aspx master page (with a repeater control in it) using a feature, download a copy, re-upload it (with no changes) and bang - error. Code blocks not allowed in this file.
As you're putting this in an html master page, you're probably just masking the real reason for the error. You could try adding an entry to the web.config (see, for example, this blog) to specify that your master page can have code blocks.

It might because You have opened
MS: before you Eval("") but there is no closing ME: after eval tag.

Related

The images do not show on page after publishing the web-application on IIS

The images do not show on page after publishing the web-application on IIS.
When I run the web-application from Visual Studio 2015, the pictures are appear correctly.the path of image is like
/media/1713/mypicture.png
But after publishing the web-application on IIS and run it, the pictures do not show.
But when I add manually the domain at first of above path, the image show correctly. same as
/domain-name/media/1713/mypicture.png.
I've used Umbraco 7.4.3, ASP.NET MVC, VS2015 and Windows 10.
EDIT: I UPGRADED IT TO UMBRACO 7.5.4 BUT STILL THERE IS THE PROBLEM.
:(
How can I solve this problem? Please help me.
umbracosettings.config:
<?xml version="1.0" encoding="utf-8" ?>
<settings>
<content>
<errors>
<error404>1</error404>
</errors>
<notifications>
<!-- the email that should be used as from mail when umbraco sends a notification -->
<email>your#email.here</email>
</notifications>
<!-- Show property descriptions in editing view "icon|text|none" -->
<PropertyContextHelpOption>text</PropertyContextHelpOption>
<!-- The html injected into a (x)html page if Umbraco is running in preview mode -->
<PreviewBadge>
<![CDATA[<a id="umbracoPreviewBadge" style="position: absolute; top: 0; right: 0; border: 0; width: 149px; height: 149px; background: url('{1}/preview/previewModeBadge.png') no-repeat;z-index: 9999999;" href="#" OnClick="javascript:window.top.location.href = '{0}/endPreview.aspx?redir={2}'"><span style="display:none;">In Preview Mode - click to end</span></a>]]></PreviewBadge>
<!-- Cache cycle of Media and Member data fetched from the umbraco.library methods -->
<!-- In seconds. 0 will disable cache -->
<UmbracoLibraryCacheDuration>1800</UmbracoLibraryCacheDuration>
<!-- How Umbraco should handle errors during macro execution. Can be one of the following values:
- inline - show an inline error within the macro but allow the page to continue rendering. Historial Umbraco behaviour.
- silent - Silently suppress the error and do not render the offending macro.
- throw - Throw an exception which can be caught by the global error handler defined in Application_OnError. If no such
error handler is defined then you'll see the Yellow Screen Of Death (YSOD) error page.
Note the error can also be handled by the umbraco.macro.Error event, where you can log/alarm with your own code and change the behaviour per event. -->
<MacroErrors>throw</MacroErrors>
<!-- These file types will not be allowed to be uploaded via the upload control for media and content -->
<disallowedUploadFiles>ashx,aspx,ascx,config,cshtml,vbhtml,asmx,air,axd,swf,xml,html,htm,svg,php,htaccess</disallowedUploadFiles>
<!-- Defines the default document type property used when adding properties in the back-office (if missing or empty, defaults to Textstring -->
<defaultDocumentTypeProperty>Textstring</defaultDocumentTypeProperty>
</content>
<security>
<!-- set to true to auto update login interval (and there by disabling the lock screen -->
<keepUserLoggedIn>false</keepUserLoggedIn>
<!-- change in 4.8: Disabled users are now showed dimmed and last in the tree. If you prefer not to display them set this to true -->
<hideDisabledUsersInBackoffice>false</hideDisabledUsersInBackoffice>
</security>
<requestHandler>
<!-- this will ensure that urls are unique when running with multiple root nodes -->
<useDomainPrefixes>false</useDomainPrefixes>
<!-- this will add a trailing slash (/) to urls when in directory url mode -->
<addTrailingSlash>true</addTrailingSlash>
</requestHandler>
<templates>
<!-- To switch the default rendering engine to MVC, change this value from WebForms to Mvc -->
<defaultRenderingEngine>Mvc</defaultRenderingEngine>
</templates>
<scheduledTasks>
<!-- add tasks that should be called with an interval (seconds) -->
<!-- <task log="true" alias="test60" interval="60" url="http://localhost/umbraco/test.aspx"/>-->
</scheduledTasks>
<!-- distributed calls must be enabled when using Umbraco in a load balanced environment -->
<distributedCall enable="false">
<!-- the id of the user who's making the calls -->
<!-- needed for security, umbraco will automatically look up correct login and passwords -->
<user>0</user>
<!--
When distributed call is enabled, you need to add all of the servers part taking in load balancing
to the server list below.
-->
<servers>
</servers>
</distributedCall>
<web.routing
trySkipIisCustomErrors="false"
internalRedirectPreservesTemplate="false" disableAlternativeTemplates="false" disableFindContentByIdPath="false"
umbracoApplicationUrl="">
</web.routing>
</settings>
I've used img tag in my cshtml file like this:
<img style="display: block;" src="#Model.Model.MainPicture" alt="#Model.Model.FirstTitle">
Sometimes if you add images in project not in usual way to include, it will not update images in build/packages, which you are submitting to IIS. Make your image in solution explorer, right click the image in solution explorer and choose properties then select "Copy always" and build project. Then publish to IIS.

Change in master page using SharePoint Designer 2013 not reflecting in HTML

I need to add a user control in master page in SharePoint designer 2013.
I have checked out the file and added the line below to it
<!--SPM:<%#Register TagPrefix="LogOut" TagName="LogOutUserControl" Src="~/_controltemplates/15/UC_LogOut/LogOut.ascx" %>-->
Now this should reflect in the master file also but after refreshing I can't see this control (comment) there in master page.
I also checked it in then also can't see this control. Any help would be appreciated.
After checking-in the master page it needs to be published (I assume this is already the case since it is an existing one) an approved.
If you are on a multi web front end environment check that the change is propagated to all front ends accordingly.
Also note, as already mentioned by Stevangelista, that you just added a <!-- comment --> and not a control as you called it. You should revise your tag there... I assume you intended to do something like this:
<!-- ... -->
<%#Register TagPrefix="LogOut" TagName="LogOutUserControl"
Src="~/_controltemplates/15/UC_LogOut/LogOut.ascx" %>
<html>
<!-- head -->
<body>
<!-- ... -->
<LogOut:LogOutUserControl runat="server">
<!-- ... -->
</body>
</html>
Note that this is untested and that you should verify the code in is snippet!

Multiple Rich Text Edit Fields in Edit View

I have a Sharepoint site with a Master Page that has a main content area and a sidebar content area.
In one of my pages I have the need to allow the user to edit the content of the main content area and the sidebar content area from the Edit mode.
Currently, in the HTML of one of my pages, in main content area of a page (inside <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">) i have the follow code snippet which appears to allow a HTML edit box in Edit mode.
<SharePoint:EmbeddedFormField id="wikiField" FieldName="wikiField" ControlMode="Display" runat="server" />
I have tried to replicate this inside the <asp:Content ContentPlaceHolderId="PlaceHolderSidebar" runat="server"> tag, but this simply displays the content of my main body content and does not give me the option to edit this.
When a user enters Edit mode, I need to display two rich text HTML editors, one for the main content and one for the sidebar. What HTML tags will allow me to achieve this?
I do not have access to SharePoint Designer 2013 and cannot install it for reasons I will not go into.
Thanks
Try using this:
<PublishingWebControls:RichHtmlField FieldName="PublishingPageContent" HasInitialFocus="True" MinimumEditHeight="400px" runat="server"/>
And add a reference to this if it's not already at the top of your master.
<%# Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
You may need to activate the publishing feature for this - I can't remember if it works without it or not.

Sharepoint calendar web part not working in Chrome Browser

I have a calendar web part in my SharePoint site which works fine in Firefox and IE but does not work in chrome browser.
This is the same situation i am facing.
http://answers.flyppdevportal.com/categories/sharepoint2010/sharepoint2010programming.aspx?ID=9dde800d-7ce0-4069-93d7-2adf2c53d94b
Any suggestions ?
One more thing to add here is that , I have a content Query web part which will rotate the Promotions using JQuery cycle plug in. It is on the same page where I have put the list and library web part with calendar Month view as a default view.
If I remove that CQWP with Promotions everything works fine but if it there it wont work
Any suggestions? I have checked for the Jquery conflicts but could not find any of them .
Thanks
I think that I have find the root cause of my problem
There is one CQWP placed on the same page with this Calendar view list.
This CQWP ha call to jquery cycle plugin which will cycle the content after some interval , due to this JQuery conflicts my calendar control is not working in chrome.
Whem I Remove this CQWP everything works like a charm!!!
1st, try to revert back to the OOB v4.master to see if the problem disappears. If it works as expected, this mean that your masterpage have some issue.
One of the most ridiculous bug in SP is that if you don't have the SiteAction control declared before the ribbon control, some javascript codes will fails.
In one of my custom master page, I have to create a second siteactions control, just before the ribbon control. I've put it into a invisible DIV to completely hide it from the user.
It ends with something like this :
<SharePoint:SPRibbon ID="SPRibbon1" runat="server" PlaceholderElementId="RibbonContainer"
CssFile="">
<SharePoint:SPRibbonPeripheralContent ID="SPRibbonPeripheralContent1" runat="server"
Location="TabRowLeft" CssClass="ms-siteactionscontainer s4-notdlg">
<!-- Here is the hidden site actions control -->
<div style="display: none">
<SharePoint:SiteActions runat="server" AccessKey="<%$Resources:wss,tb_SiteActions_AK%>"
ID="SiteActionsMenuMain" PrefixHtml="" SuffixHtml="" MenuNotVisibleHtml="&nbsp;">
<CustomTemplate>
</CustomTemplate>
</SharePoint:SiteActions>
</div>
<asp:ContentPlaceHolder ID="PlaceHolderGlobalNavigation" runat="server" Visible="false">
<SharePoint:PopoutMenu
runat="server"
>
.... Removed for readability ....
</SharePoint:PopoutMenu>
<div class="s4-die">
<asp:ContentPlaceHolder ID="PlaceHolderGlobalNavigationSiteMap" runat="server" Visible="false">
</asp:ContentPlaceHolder>
</div>
</asp:ContentPlaceHolder>
</SharePoint:SPRibbonPeripheralContent>
<SharePoint:SPRibbonPeripheralContent runat="server" Location="TabRowRight" ID="RibbonTabRowRight"
CssClass="s4-trc-container s4-notdlg">
.... Removed for readability ....
</SharePoint:SPRibbonPeripheralContent>
</SharePoint:SPRibbon>
For your information, this behavior is due to one the inner control of the site action (PublishingConsole if I'm right). This inner control will produces some javascript global variable declaration (language and one another). This global variables are required by the ribbon control to works as expected.

SharePoint Search on default Masterpage

I am trying to enable the search bar on my default master page. In the source code of the master page there is the following:
<asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server">
<SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox"/>
</asp:ContentPlaceHolder>
In the render of the page in design mode it says [DelegateControl]. When I publish the page, I do not see a search box, I see nothing... can someone point me in the direction as how to enable search on my default master page, thanks.
I had the exact same problem but eventually found a very simple solution. You just need to make sure your asp:ContentPlaceHolder is within an html form. I don't know exactly why this is the case, but simply changing your code to
<form id="Form1" runat="server">
<asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server">
<SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox"/>
</asp:ContentPlaceHolder>
</form>
should solve the problem.
I found this very simple application.master page: http://blogs.microsoft.co.il/blogs/justguy/archive/2008/08/31/empty-application-master.aspx
When the search boxes worked using this simple master page, I was able to track down the problem and find the needed element.
Are you certain that you MOSS Search service is correctly configured?
If not, check this article:
http://www.mysharepointblog.com/post/2008/10/Configure-Search-On-MOSS-2007-(Microsoft-Office-SharePoint-Server).aspx
Have you activated the "Office SharePoint Server Standard Site Collection features" from the site features?

Resources