RSS

Category Archives: Sharepoint Designer

Disable Person Link in Data View Web Part in Sharepoint 2010 & 2007


When displaying the column @Author in a Data View Web Part (DVWP) SharePoint displays a link to the UserDisp.aspx page.

If you don’t want to have the link just extract the Person’s name from the column HTML generated code.

Just replace:

<xsl:value-of disable-output-escaping=”yes” select=”@Author”/>

By:

2007
<xsl:value-of disable-output-escaping=”yes” select=”substring-after(substring-before(substring-after(@Author, ‘ID=’), ‘&lt;’), ‘&gt;’)”/>

UPDATED:

Here is the code for Sharepoint 2010 version

<xsl:value-of disable-output-escaping=”yes” select=”substring-after(substring-before(substring-after(@Author, ‘ID=’), ‘&lt;’), ‘&gt;’)”/>
 
2 Comments

Posted by on March 27, 2011 in Sharepoint Designer, Tips & Tricks

 

Tags: ,

How to enable Sharepoint spell checker in custom pages ?


1. Make sure you have the right page directive on the page you are adding the control to

 <%@ Register TagPrefix=”SharePoint” Namespace=”Microsoft.SharePoint.WebControls” Assembly=”Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>

2. On the head of your page, add the following controls, which will give you the javascript required for the spell checker to run:

<SharePoint:ScriptLink ID=”ScriptLink1″ Language=”javascript” Name=”core.js” runat=”server” />
<SharePoint:ScriptLink ID=”ScriptLink2″ Language=”javascript” Name=”bform.js” runat=”server” />
<SharePoint:ScriptLink ID=”ScriptLink3″ Language=”javascript” Name=”SpellCheckEntirePage.js” runat=”server” />

3. Add the following block of javascript code to your page:

<script language=”javascript” type=”text/javascript”>
function doSpellCheck() {
SpellCheckEntirePage(‘/_vti_bin/SpellCheck.asmx’, ‘/_layouts/SpellChecker.aspx’);
}</script>
NOTE: Take care of single quotes after pasting
4. Now all you need to do is create a link or a button which starts the spell checker. to this you just need to add the onclick javascript method ‘doSpellCheck()’

<a href=”javascript:doSpellCheck()”>Spelling…</a>

NOTE: if you want to exclude spell checker of any control use excludeFromSpellCheck”true”
eg:

 
2 Comments

Posted by on January 18, 2011 in Sharepoint Designer, Tips & Tricks

 

Tags:

No item exists at http://SERVER/SITE/mypage.aspx?ID=1. It may have been deleted or renamed by another user


Cause:

When we try passing the Query Parameter Name as ID to the .aspx Page (which itself is the record in the document library) Sharepoint loses track of what ID is used for. Sharepoint no longer knows if ID is the document in the document library or the ID of the listItem which we need to update using this .aspx page. This problem happens because Sharepoint has its own variable named ID which it uses to identify documents/pages on the server. Our solution should not be using a variable named ID.

Solution:

Change the query string parameter from ID to CustomID. Then change the details page from QueryString(ID) to QueryString(CustomID). Once this is done the page will display with no errors.

Source : http://support.microsoft.com/kb/972225

 
1 Comment

Posted by on November 11, 2010 in Dataview, Sharepoint Designer

 

How to add numbering column in dataview webpart?


  • Open the page in sharepoint designer
  • Insert dataview wepart
  • Select your columns to query
  • Now click on the first column & insert new column on left
  • In the new column just paste below code…thts it

<xsl:value-of select=”position()” />

If you need any bulleted images. insert an image in the column.

 
1 Comment

Posted by on April 21, 2010 in Code Snippets, Sharepoint Designer

 

SharePoint Data View Conditional Formatting based on user permissions (IfHasRights)


Below are the values for conditional formatting

example usage : <xsl:if test=”ddwrt:IfHasRights(“REPLACE THIS WITH BELOW VALUE”)”><img alt=”” border=”0″ src=”../../PublishingImages/btn_AddActionItem.jpg” width=”191″ height=”37″ /></xsl:if>

ViewListItems – 1

AddListItems – 2

EditListItems – 4

DeleteListItems – 8

ApproveItems – 16

OpenItems – 32

ViewVersions – 64

DeleteVersions – 128

CancelCheckout – 256

PersonalViews – 512

ManageLists – 2048

ViewFormPages – 4096

Open – 65536

ViewPages – 131072

AddAndCustomizePages – 262144

ApplyThemeAndBorder – 524288

ApplyStyleSheets – 1048576

ViewUsageData – 2097152

CreateSSCSite – 4194314

ManageSubwebs – 8388608

CreateGroups – 16777216

ManagePermissions – 33554432

BrowseDirectories – 67108864

BrowseUserInfo – 134217728

AddDelPrivateWebParts – 268435456

UpdatePersonalWebParts – 536870912

ManageWeb – 1073741824

UseRemoteAPIs – 137438953472

ManageAlerts – 274877906944

CreateAlerts – 549755813888

EditMyUserInfo – 1099511627776

EnumeratePermissions – 4611686018427387904

FullMask – 9223372036854775807

To ensure that users only see the edit button if they are the author of the posting, or a site owner we added the following conditional formatting:

test=”ddwrt:IfHasRights(2048) or contains(@Author,$Userid)”

 
4 Comments

Posted by on October 19, 2009 in Code Snippets, Sharepoint Designer

 

Tags:

Display attachments in sharepoint dataview webpart using sharepoint designer


Use below code to show attachments in sharepoint dataview webpart .

Use this for Single List Item View:

<SharePoint:AttachmentsField ControlMode=”Display” ItemId=”{@ID}” EnableViewState=”true” FieldName=”Attachments”  runat=”server”/>

Use this for Multiple List item Vew:

<SharePoint:AttachmentButton ControlMode=”Edit” Enabled=”true” ItemId=”{@ID}” runat=”server” Visible=”false”/><SharePoint:AttachmentsField ControlMode=”Display” ItemId=”{@ID}” EnableViewState=”true” FieldName=”Attachments” runat=”server”/>

OR

<xsl:element name=”SharePoint:AttachmentsField”>

 <xsl:attribute name=”runat”>server</xsl:attribute>

 <xsl:attribute name=”FieldName”>Attachments</xsl:attribute>

 <xsl:attribute name=”ControlMode”>Display</xsl:attribute>

 <xsl:attribute name=”Visible”>true</xsl:attribute>

 <xsl:attribute name=”ItemId”>

  <xsl:value-of select=”@ID”/>

 </xsl:attribute>

</xsl:element>

NOTE: Please verify double quotes once you copied to sharepoint designer

 
2 Comments

Posted by on August 23, 2009 in Code Snippets, Dataview, Sharepoint Designer

 

Tags: ,

How to change choice field “allow fill-in choice” default text ‘Specify your own value:’ to custom text?


  • Open default.master (found in the _catalogs\masterpages folder) in SharePoint Designer. 
  • Before the </HEAD> end tag I added the following js code:

<script type=”text/javascript”>
 function changeSpecifyOwnValue() {

  var node_list = document.getElementsByTagName(‘input’);
   
  for (var i = 0; i < node_list.length; i++) {
      var node = node_list[i ];  // NOTE: there is a space here after the i, if not a lightbulb was added… delete this
    
      if (((node.getAttribute(‘type’) == ‘radio’) && (node.getAttribute(‘value’) != ‘DropDownButton’)) || (node.getAttribute(‘type’) == ‘checkbox’)) {
          if (node.nextSibling.innerHTML==”Specify your own value:”) {
           node.nextSibling.innerHTML = “Other:”;
          }
      }
  }    

 }
</script>

After this I added the function above to be executed in the body onload, below is the sample usgae:

<BODY scroll=”yes” onload=”javascript:if (typeof(_spBodyOnLoadWrapper) != ‘undefined’) _spBodyOnLoadWrapper(); changeSpecifyOwnValue();”>