Hi guys,
Thanks for those that showed up at the Auckland SharePoint User Group meeting.
Here it is the presentation:
Cheers,
Marcel Medina
Click here to read the same content in Portuguese.
Hi guys,
I am speaking at the SharePoint User Group Auckland on May 20th about "Leveraging SharePoint Single Page Apps".
In this session check how to leverage the SharePoint App Architecture by using Single Page Apps.
You will get familiarised with the concept, pros, cons and javascript frameworks that make it possible. Your Justice League superheroes will be there, hope you can join us too.
More details, find here: http://www.meetup.com/Auckland-SharePoint-User-Group/events/179945782/
Cheers,
Marcel Medina
Click here to read the same content in Portuguese.
Hi everyone,
Nice to be back sharing my experiences with SharePoint 2013. It is been some time since my last post, this time I am posting a workaround to get the SocialCommentControl to work with Html5.
In SP2013 this control is deprecated, so I believe that’s why nothing was done to it. Once you add it to a page layout it breaks the markup.
I am talking about the control, so if you are using the SocialCommentWebpart the behaviour is the same, as it wraps up the control with webpart properties.
Googling this didn’t help, so I decided to reverse engineer the SharePoint assemblies and check the implementation. The problem lies on a html div tag. In Html 5 self-closing tags don’t work, but this control uses it, as below:
Code Snippet
- protected override void CreateChildControls()
- {
- base.CreateChildControls();
- if (!this.IsUPAEnabled)
- {
- string text = SPHttpUtility.HtmlEncode(StringResourceManager.GetString(LocStringId.SocialComment_NeedAuthenticatedMessage));
- text = string.Format(CultureInfo.InvariantCulture, "<span>{0}</span>", new object[]
- {
- text
- });
- this.Controls.Add(new LiteralControl(text));
- return;
- }
- this.Controls.Add(new LiteralControl("<div class=\"ms-socialCommentContents\" id=\"" + this.RootElementId + "\">"));
- if (this.IsShowNewArea)
- {
- this.RenderNewArea();
- }
- this.RenderEditArea();
- this.RenderErrorArea();
- this.RenderPagingControlContainer();
- this.Controls.Add(new LiteralControl("<div id=\"" + this.ClientID + "_PlaceHolder\" />"));
- this.Controls.Add(new LiteralControl("</div>"));
- }
Line 14 displays the problem. The tag div is self-closed, which doesn’t work in html 5.
The solution for this is simple. Because there is no closing tag, by adding a div closing tag does the trick.
Create a new class, inherit from SocialCommentControl and override the method CreateChildControls() by adding this closing tag. As below:
Code Snippet
- public class SocialCommentHtml5Control : SocialCommentControl
- {
- protected override void CreateChildControls()
- {
- base.CreateChildControls();
- this.Controls.Add((Control)new LiteralControl("</div>"));
- }
- }
That’s it. Add it to your page layout and use it on SP2013.
I hope it helps.
Cheers,
Reference:
Microsoft Forum
Click here to read the same content in Portuguese.