The publishing masterpage for the new website design now includes a readcrumb
trail leading back to the Home site. The text in the breadcrumbs shows the Site
titles as well as the current page title.
<asp:SiteMapPath ID="SiteMapPath" runat="server"
CssClass="cgcc-breadcrumb" RenderCurrentNodeAsLink="true" skiplinktext="skip
breadcrumb"/>
CGCC-v4.css is where the style is set so it's
easy to change the color or font.
.cgcc-breadcrumb span a
{
color:#404040;
text-decoration:none;
}
Saturday, April 21, 2012
Friday, April 20, 2012
Controlling SharePoint's Global Navigation
Lesley and I were talking about how we as members of the WebCS Owners
group can keep full control of the Global Navigation menu on the new design, thus preventing editors from changing the global nav in their site. Editors will need to
have access to the Site navigation so it isn't a matter of restricting their permissions. The way we set this up in the current site is to use a custom list to hold the global navigation entries.
There is a way to specify the Home site's global navigation instead of the current site's global navigation. By using the 2 properties below we are telling the menu to only use the Home site's global navigation when populating the menu for all sites.
<PublishingNavigation:PortalSiteMapDataSource
...
StartFromCurrentNode="false"
StartingNodeUrl="/"
.../>
What this means is editors can make changes to their site's global navigation settings without affecting what is displayed on the pages. Webmasters can make a change to the global navigation entries in the Home site and it will affect all sites regardless of whether or not the sub-sites are inheriting.
group can keep full control of the Global Navigation menu on the new design, thus preventing editors from changing the global nav in their site. Editors will need to
have access to the Site navigation so it isn't a matter of restricting their permissions. The way we set this up in the current site is to use a custom list to hold the global navigation entries.
There is a way to specify the Home site's global navigation instead of the current site's global navigation. By using the 2 properties below we are telling the menu to only use the Home site's global navigation when populating the menu for all sites.
<PublishingNavigation:PortalSiteMapDataSource
...
StartFromCurrentNode="false"
StartingNodeUrl="/"
.../>
What this means is editors can make changes to their site's global navigation settings without affecting what is displayed on the pages. Webmasters can make a change to the global navigation entries in the Home site and it will affect all sites regardless of whether or not the sub-sites are inheriting.
Tuesday, March 13, 2012
Comparing Publishing Dates of Blog Posts
When displaying the list of published posts from a SharePoint Blog, you may want
to hide certain elements such as the Publish Date div box if there are multiple
posts on the same day. The XSL code below will compare the publish date of the
post to the previous post and display or not display the div
accordingly.
<xsl:variable name="PrevPosition" select="count(./preceding-sibling::*)" />
<xsl:if test="($Rows/Row[$PrevPosition]/@PublishedDate.MonthDayOnly != $thisNode/@PublishedDate.MonthDayOnly) or ($PrevPosition+1 = $FirstRow)">
...
</xsl:if>
<xsl:variable name="PrevPosition" select="count(./preceding-sibling::*)" />
<xsl:if test="($Rows/Row[$PrevPosition]/@PublishedDate.MonthDayOnly != $thisNode/@PublishedDate.MonthDayOnly) or ($PrevPosition+1 = $FirstRow)">
...
</xsl:if>
Tuesday, February 7, 2012
Changing the SP Ribbon background color using CSS
To change the background color of SharePoint's ribbon, override the following
styles from the corev4.css file.
.ms-SpLinkButtonActive
{
background-color:orange !important;
}
.ms-welcomeMenu a:hover
{
background-color: orange !important;
}
.ms-siteactionsmenu .ms-siteactionsmenuhover
{
background-color: orange !important;
color:#000000 !important;
}
.ms-cui-ribbonTopBars
{
background: orange url() repeat-x !important;
padding-top:0px;
}
.ms-SpLinkButtonActive
{
background-color:orange !important;
}
.ms-welcomeMenu a:hover
{
background-color: orange !important;
}
.ms-siteactionsmenu .ms-siteactionsmenuhover
{
background-color: orange !important;
color:#000000 !important;
}
.ms-cui-ribbonTopBars
{
background: orange url() repeat-x !important;
padding-top:0px;
}
Thursday, December 22, 2011
Setting the forecolor of a control based upon the backcolor
The code below will set the forecolor or font color of a control, such as a
label, to white or black, depending on the background
color.
System.Drawing.Color foreColor = System.Drawing.Color.Black;
// all colors coming in are in Hex format. No Known colors but we'll check anyway.
int r;
int g;
int b;
if (backColor.IsKnownColor)
{
r = backColor.R;
g = backColor.G;
b = backColor.B;
}
else
{
r = int.Parse(backColor.ToString().Substring(8, 2), System.Globalization.NumberStyles.HexNumber);
g = int.Parse(backColor.ToString().Substring(10, 2), System.Globalization.NumberStyles.HexNumber);
b = int.Parse(backColor.ToString().Substring(12, 2), System.Globalization.NumberStyles.HexNumber);
}
int changeToWhite = 0;
if (r <= 128)
{
changeToWhite ++;
}
if (g <= 128)
{
changeToWhite ++;
}
if (b <= 128)
{
changeToWhite ++;
}
if (changeToWhite > 2)
{
foreColor = System.Drawing.Color.White;
}
System.Drawing.Color foreColor = System.Drawing.Color.Black;
// all colors coming in are in Hex format. No Known colors but we'll check anyway.
int r;
int g;
int b;
if (backColor.IsKnownColor)
{
r = backColor.R;
g = backColor.G;
b = backColor.B;
}
else
{
r = int.Parse(backColor.ToString().Substring(8, 2), System.Globalization.NumberStyles.HexNumber);
g = int.Parse(backColor.ToString().Substring(10, 2), System.Globalization.NumberStyles.HexNumber);
b = int.Parse(backColor.ToString().Substring(12, 2), System.Globalization.NumberStyles.HexNumber);
}
int changeToWhite = 0;
if (r <= 128)
{
changeToWhite ++;
}
if (g <= 128)
{
changeToWhite ++;
}
if (b <= 128)
{
changeToWhite ++;
}
if (changeToWhite > 2)
{
foreColor = System.Drawing.Color.White;
}
Tuesday, October 18, 2011
Using AJAX in a SharePoint webpart - UpdatePanel control
To take advantage of AJAX and partial page rendering in a SP2010 webpart, add
your radio button, dropdown list, etc. controls to an UpdatePanel for a better
user experience.
The CGCC-Parent.master file already contains the ScriptManager control so there is no need to add this to your webpart.
1. Create an instance of the panel. Set the UpdateMode to conditional.
updatePanel2 = new UpdatePanel();
updatePanel2.UpdateMode = UpdatePanelUpdateMode.Conditional;
2. Add your controls to the updatePanel. Make sure you add the controls to the ContentTemplateContainer.
updatePanel1.ContentTemplateContainer.Controls.Add(creditRadio);
updatePanel1.ContentTemplateContainer.Controls.Add(creditRequired);
updatePanel1.ContentTemplateContainer.Controls.Add(campusQ1);
updatePanel1.ContentTemplateContainer.Controls.Add(creditCheckBox);
3. Finally, and add your panel to the list of controls.
Controls.Add(updatePanel1);
The CGCC-Parent.master file already contains the ScriptManager control so there is no need to add this to your webpart.
1. Create an instance of the panel. Set the UpdateMode to conditional.
updatePanel2 = new UpdatePanel();
updatePanel2.UpdateMode = UpdatePanelUpdateMode.Conditional;
2. Add your controls to the updatePanel. Make sure you add the controls to the ContentTemplateContainer.
updatePanel1.ContentTemplateContainer.Controls.Add(creditRadio);
updatePanel1.ContentTemplateContainer.Controls.Add(creditRequired);
updatePanel1.ContentTemplateContainer.Controls.Add(campusQ1);
updatePanel1.ContentTemplateContainer.Controls.Add(creditCheckBox);
3. Finally, and add your panel to the list of controls.
Controls.Add(updatePanel1);
Thursday, September 22, 2011
More on the TextBox Counter by SKMControls
I found a free TextBox counter by SKMControls that
counts the amount of characters in a multiline asp:TextBox control. This is
useful for Asp.NET pages with Note fields where end users tend to write alot but
yet you have limits to how many characters the database field will hold.
First add the file skmcontrols2.dll to the bin folder.
In your aspx .NET page, register the control.
<% @ Register Assembly="skmControls2" Namespace="skmControls2" TagPrefix="skm" %>
Next, add your control to the page.
<skm:TextBoxCounter runat="server" ForeColor="GrayText" WarningPercentage="80" MaxCharacterLength="7900" TextBoxControlId="NoteTextBox" ID="TextBoxCounter1"></skm:TextBoxCounter>
The TextBoxControlID property is used to bind the control to the multi-line textbox on your page.
First add the file skmcontrols2.dll to the bin folder.
In your aspx .NET page, register the control.
<% @ Register Assembly="skmControls2" Namespace="skmControls2" TagPrefix="skm" %>
Next, add your control to the page.
<skm:TextBoxCounter runat="server" ForeColor="GrayText" WarningPercentage="80" MaxCharacterLength="7900" TextBoxControlId="NoteTextBox" ID="TextBoxCounter1"></skm:TextBoxCounter>
The TextBoxControlID property is used to bind the control to the multi-line textbox on your page.
Subscribe to:
Posts (Atom)