Monday, September 24, 2012

Customizing the Summary Links with custom itemStyles.xslt


The Summary Links control (PublishingWebControls:summarylinkfieldcontrol) allows you to specify your own styles using the ItemXslLink property as shown below. 

<PublishingWebControls:summarylinkfieldcontrol ItemXslLink="/Style Library/XSL Style Sheets/InsideHomeItemStyle.xsl" .../>

In SP Designer, you can copy an existing xsl file and rename it, you can then update the file with your own styles and template names.

As a demo of how this works, the following New Home page layout has two Summary Link areas.


The custom itemStyles.xsl file I created has only 2 styles to chose from; insideHome1 & insideHome2. Both styles include a bullet icon in front of the link but insideHome1 colors the link teal, insideHome2 colors the link orange.

If you have a Links Webpart that you've added to a zone in your publishing page, you can export the webpart and modify the webpart file with the following xml:


<property name="HeaderXslLink" type="string">/Style Library/XSL Style Sheets/CustomHeader.xsl</property>
<property name="ItemXslLink" type="string">/Style Library/XSL Style Sheets/CustomItemStyle.xsl</property>

Save, add and upload your webpart. Your new header and styles will now be available.

Tuesday, September 18, 2012

Using the Previous function to supress Detail rows


When your query in Crystal does not return Distinct records, you may want to supress rows in the Details section based upon the previous value of a field or fields. Add the following code to the Supress code area in the Section Expert for the Details section:

 
if (not onfirstrecord) then
    previous({RDS_CLASS_VW.CLASS_CLASS_NBR})={RDS_CLASS_VW.CLASS_CLASS_NBR}

Wednesday, September 12, 2012

Using the IN Operator in a CAML Query

The In operator is used in an SQL query allows you to specify multiple values in a
WHERE clause. The CAML query language also uses the IN operator, in place of using multiple ORs, to return multiple values of a column.

<In><FieldRef Name='Col1'/>
    <Values>
        <Value Type='Text'>A</Value>
        <Value Type='Text'>B</Value>
        <Value Type='Text'>C</Value>
    </Values>
</In>

Monday, July 30, 2012

Using PowerShell to downgrade a SharePoint v4 site to v3


Use the following powershell commands on a SharePoint front end server to downgrade a v4 site to v3.

$Web=Get-SPWeb http://<site name>/<site>
$Web.UIVersion=3
$Web.UIVersionConfigurationEnabled=$true
$Web.update()

Wednesday, July 18, 2012

Using the Eval method in a SharePoint master or layout page

Examples of using Eval method in SharePoint master or layout page:


In this example "Include Time" is a SP yes/no field where we're checking for a value of "yes":



<%# Eval("Include Time").ToString() == "True" ? " (" + Eval("Start Time","{0:hh:mm tt}") + ")" : "" %>



In this example "Active" is a SP yes/no field where it's casted to a boolean value and then used to control visibility of an asp:Label control:



Visible='<%# bool.Parse(Eval("Active").ToString()) %>'

Another example of setting the Visible property. If the value of Descrition is null, hide the control:

Visible='<%# bool.Parse(Eval("Description") == null ? "False" : "True") %>'

Tuesday, July 10, 2012

SubjectsAll dynamic prompt for Crystal


The prompt group 'RDS SubjAll M' in Crystal Reports requires logic in the Record Selection formula to account for the ' All' value for all subjects. Below is an example of how to construct the query:

if ({?Subject} <> " All") then 
({?Subject} = {RDS_CLASS_VW.CLASS_SUBJECT_CD} and
{?Institution} = {RDS_CLASS_VW.CLASS_INSTITUTION_CD})
else
{?Institution} = {RDS_CLASS_VW.CLASS_INSTITUTION_CD}

If the Subject parameter equals ' All' we simply ignore it.

Monday, July 9, 2012

Removing annoying checkboxes in a List web part

When I add a List web part to a page, I'm left with a bunch of annoying check boxes in front of each item, as shown below:










To get rid of these, since they don't really serve any purpose on our public pages, I've added a content editor web part to the page with the following css code. Make sure you add the code using the source editor:

<style type="text/css">
TH.ms-vh-icon {
DISPLAY: none
}
.ms-vb-itmcbx {
DISPLAY: none
}
</style>

I then get a cleaner look to the listing with the check boxes removed from the page.