I have a list with the fields "Effective" and "Expires". Both fields are Date and Time data types. I want to show the list items where the current date/time is greater than Effective and less than Expires. I believe my code below looks only at the Expires Date and NOT at both date and time. I'm not an XSL developer so any help would be GREATLY appreciated!! (tried to format code but not much luck) Thanks.
...
<script type="text/c#" runat="server">
void Page_Load(object sender, EventArgs args)
{
dsrPortalSiteMap.StartingNodeUrl = Request.Path;
string[] pathPieces = Request.Path.Split('/');
int pathStructureLength = pathPieces .Length;
bool isTabSubsite = false;
if (pathPieces[1].ToLower() == "residential-customers" || pathPieces[1].ToLower() == "business-customers")
isTabSubsite = true;
if (isTabSubsite)
{
if (pathStructureLength == 5)
{
dsrPortalSiteMap.StartingNodeOffset = -1;
}
} else {
if (pathStructureLength == 4)
{
dsrPortalSiteMap.StartingNodeOffset = -1;
}
}
}
protected void OnLeftNavItemDataBound(object sender, RepeaterItemEventArgs args)
{
HtmlAnchor aTopLink = args.Item.FindControl("aTopLink") as HtmlAnchor;
Repeater repLeftSubNav = args.Item.FindControl("repLeftSubNav") as Repeater;
SiteMapNode node = args.Item.DataItem as SiteMapNode;
string requestPath = Request.Path.ToLower();
if (requestPath.IndexOf(node.Url.ToLower()) >= 0)
{
if (node.HasChildNodes)
{
aTopLink.Attributes["class"] += " SELECTED activeParent";
repLeftSubNav.DataSource = node.ChildNodes;
repLeftSubNav.DataBind();
} else {
aTopLink.Attributes["class"] += " SELECTED";
}
}
if (requestPath.IndexOf(node.Url.ToLower().Substring(0,node.Url.LastIndexOf('/'))) >= 0 && node.HasChildNodes)
{
aTopLink.Attributes["class"] += " activeParent";
repLeftSubNav.DataSource = node.ChildNodes;
repLeftSubNav.DataBind();
}
}
protected void OnLeftSubNavItemDataBound(object sender, RepeaterItemEventArgs args)
{
if (args.Item.FindControl("aLink") == null)
return;
HtmlAnchor aLink= args.Item.FindControl("aLink") as HtmlAnchor;
SiteMapNode node = args.Item.DataItem as SiteMapNode;
if (Request.Path.ToLower().IndexOf(node.Url.ToLower()) >= 0)
{
aLink.Attributes["class"] += " SELECTED";
}
}
</script>
<asp:Content ContentPlaceholderID="PlaceHolderPageTitle" runat="server">
<SharePointWebControls:FieldValue id="PageTitle" FieldName="Title" runat="server"/>
</asp:Content>
<asp:Content ContentPlaceholderID="PlaceHolderMain" runat="server">
<WebPartPages:SPProxyWebPartManager runat="server" id="ProxyWebPartManager"></WebPartPages:SPProxyWebPartManager>
<PublishingNavigation:PortalSiteMapDataSource runat="server" id="dsrPortalSiteMap" StartingNodeOffset="-2" ShowStartingNode="false" TreatStartingNodeAsCurrent="false"/>
<div class="breadcrumbDiv">
<asp:SiteMapPath runat="server" id="ctlBreadCrumb" SiteMapProvider="CurrentNavSiteMapProviderNoEncode"/>
</div>
<!-- main contant start -->
<div class="mainContentWrap">
<div class="leftNav">
<div>
<asp:Repeater ID="repLeftNav" OnItemDataBound="OnLeftNavItemDataBound" DataSourceID="dsrPortalSiteMap" runat="server">
<ItemTemplate>
<a id="aTopLink" href='<%# Eval("Url") %>' class="MENU-ITEM-1" runat="server"><%# Eval("Title") %></a><asp:Repeater ID="repLeftSubNav" OnItemDataBound="OnLeftSubNavItemDataBound" runat="server">
<HeaderTemplate>
<div class="subNav"><ul>
</HeaderTemplate>
<ItemTemplate>
<li><a id="aLink" href='<%# Eval("Url") %>' runat="server"><%# Eval("Title") %></a></li>
</ItemTemplate>
<FooterTemplate>
</ul></div>
</FooterTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>
</div>
</div>
<div class="centerContentDiv centerContentDivT2">
<div class="topBnr">
<PublishingWebControls:EditModePanel PageDisplayMode="Edit" runat="server">
<div>
<PublishingWebControls:RichImageField FieldName="Page_x0020_Heading_x0020_Image_x0020_Wide" runat="server">
</PublishingWebControls:RichImageField>
</div>
<div class="last">
<PublishingWebControls:RichImageField FieldName="Page_x0020_Heading_x0020_Image_x0020_Narrow" runat="server">
</PublishingWebControls:RichImageField>
</div>
</PublishingWebControls:EditModePanel>
<PublishingWebControls:EditModePanel PageDisplayMode="Display" runat="server">
<div>
<SharePointWebControls:FieldValue FieldName="Page_x0020_Heading_x0020_Image_x0020_Wide" runat="server">
</SharePointWebControls:FieldValue>
</div>
<div class="last">
<SharePointWebControls:FieldValue FieldName="Page_x0020_Heading_x0020_Image_x0020_Narrow" runat="server">
</SharePointWebControls:FieldValue>
</div>
</PublishingWebControls:EditModePanel>
</div>
<div style="clear:both;">
<h1 align="center" >SPECIAL NOTICES</h1>
<WebPartPages:WebPartZone id="g_E7E174C4A70340C4BC13F0ABB5909CEE" runat="server" title="Zone 1"><ZoneTemplate>
<WebPartPages:ContentEditorWebPart runat="server" __MarkupType="xmlmarkup" WebPart="true" __WebPartId="{85D1693F-547A-4E49-932F-FAF544CC9D8D}" >
<WebPart xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/WebPart/v2">
<Title>Content Editor Web Part</Title>
<FrameType>Default</FrameType>
<Description>Use for formatted text, tables, and images.</Description>
<IsIncluded>true</IsIncluded>
<PartOrder>1</PartOrder>
<FrameState>Normal</FrameState>
<Height />
<Width />
<AllowRemove>true</AllowRemove>
<AllowZoneChange>true</AllowZoneChange>
<AllowMinimize>true</AllowMinimize>
<AllowConnect>true</AllowConnect>
<AllowEdit>true</AllowEdit>
<AllowHide>true</AllowHide>
<IsVisible>false</IsVisible>
<DetailLink />
<HelpLink />
<HelpMode>Modeless</HelpMode>
<Dir>Default</Dir>
<PartImageSmall />
<MissingAssembly>Cannot import this Web Part.</MissingAssembly>
<PartImageLarge>/_layouts/images/mscontl.gif</PartImageLarge>
<IsIncludedFilter />
<ExportControlledProperties>true</ExportControlledProperties>
<ConnectionID>00000000-0000-0000-0000-000000000000</ConnectionID>
<ID>g_85d1693f_547a_4e49_932f_faf544cc9d8d</ID>
<ContentLink xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" />
<Content xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor"><![CDATA[<style type="text/css">
HR
{
color: #ff6600;
}
</style>]]></Content>
<PartStorage xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" />
</WebPart>
</WebPartPages:ContentEditorWebPart>
<WebPartPages:DataFormWebPart runat="server" ShowWithSampleData="False" AllowRemove="True" AllowHide="True" SuppressWebPartChrome="False" PartImageLarge="" ViewContentTypeId="" ExportMode="All" Dir="Default" MissingAssembly="Cannot import this Web Part." ID="g_724bc206_6755_46b4_8eeb_a88268da3bee" IsIncludedFilter="" DetailLink="" AllowEdit="True" UseSQLDataSourcePaging="True" HelpMode="Modeless" IsIncluded="True" Description="" NoDefaultStyle="TRUE" FrameState="Normal" AllowConnect="True" ViewFlag="0" AllowZoneChange="True" AllowMinimize="True" Title="SPECIAL NOTICES" PartOrder="2" PageSize="-1" FrameType="None" HelpLink="" PartImageSmall="" ConnectionID="00000000-0000-0000-0000-000000000000" ExportControlledProperties="True" ChromeType="None" IsVisible="True" __MarkupType="vsattributemarkup" __WebPartId="{724BC206-6755-46B4-8EEB-A88268DA3BEE}" __AllowXSLTEditing="true" WebPart="true" Height="" Width=""><ParameterBindings>
<ParameterBinding Name="dvt_apos" Location="Postback;Connection"/>
<ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/>
<ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"/>
<ParameterBinding Name="CurrentDateTime" Location="None" DefaultValue=""/>
<ParameterBinding Name="ListID" Location="None" DefaultValue="{52DAF3C0-8865-4C71-AD43-2F0BD8E5349A}"/>
</ParameterBindings>
<DataFields>@Title,S.No;@Body,Body;@Expires,Expires;@Effective,Effective;@Incremen,Increment Number for Next Notice;@ID,ID;@ContentType,Content Type;@Modified,Modified;@Created,Created;@Author,Created By;@Editor,Modified By;@_UIVersionString,Version;@Attachments,Attachments;@File_x0020_Type,File Type;@FileLeafRef,Name (for use in forms);@FileDirRef,Path;@FSObjType,Item Type;@_HasCopyDestinations,Has Copy Destinations;@_CopySource,Copy Source;@ContentTypeId,Content Type ID;@_ModerationStatus,Approval Status;@_UIVersion,UI Version;@Created_x0020_Date,Created;@FileRef,URL Path;</DataFields>
<DataSources>
<SharePointWebControls:SPDataSource runat="server" DataSourceMode="List" SelectCommand="<View><Query><Where><Gt><FieldRef Name="Expires"/><Value Type="DateTime"><Today/></Value></Gt></Where></Query></View>" UseInternalName="true" ID="dataformwebpart2"><SelectParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{52DAF3C0-8865-4C71-AD43-2F0BD8E5349A}"/></SelectParameters><UpdateParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{52DAF3C0-8865-4C71-AD43-2F0BD8E5349A}"/></UpdateParameters><InsertParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{52DAF3C0-8865-4C71-AD43-2F0BD8E5349A}"/></InsertParameters><DeleteParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{52DAF3C0-8865-4C71-AD43-2F0BD8E5349A}"/></DeleteParameters>
</SharePointWebControls:SPDataSource>
</DataSources>
<Xsl>
<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal">
<xsl:output method="html" indent="no"/>
<xsl:decimal-format NaN=""/>
<xsl:param name="dvt_apos">'</xsl:param>
<xsl:param name="Today">CurrentDate</xsl:param>
<xsl:param name="CurrentDateTime" />
<xsl:param name="ListID">{52DAF3C0-8865-4C71-AD43-2F0BD8E5349A}</xsl:param>
<xsl:variable name="dvt_1_automode">0</xsl:variable>
<xsl:template match="/" xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:SharePoint="Microsoft.SharePoint.WebControls">
<xsl:call-template name="dvt_1"/>
</xsl:template>
<xsl:template name="dvt_1">
<xsl:variable name="dvt_StyleName">Table</xsl:variable>
<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/>
<table border="0" width="100%" cellpadding="2" cellspacing="0"><!--
<tr valign="top">
<xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">
<th class="ms-vh" width="1%" nowrap="nowrap"></th>
</xsl:if>
<th class="ms-vh" nowrap="nowrap">Created</th>
<th class="ms-vh" nowrap="nowrap">Expires</th>
<th class="ms-vh" nowrap="nowrap">Effective</th>
<th class="ms-vh" nowrap="nowrap">Body</th>
</tr>-->
<xsl:call-template name="dvt_1.body">
<xsl:with-param name="Rows" select="$Rows"/>
</xsl:call-template>
</table>
</xsl:template>
<xsl:template name="dvt_1.body">
<xsl:param name="Rows"/>
<xsl:for-each select="$Rows">
<xsl:call-template name="dvt_1.rowview"/>
</xsl:for-each>
</xsl:template>
<xsl:template name="dvt_1.rowview">
<tr>
<xsl:if test="position() mod 2 = 1">
<xsl:attribute name="class">ms-alternating</xsl:attribute>
</xsl:if>
<xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">
<!--<td class="ms-vb" width="1%" nowrap="nowrap">
<span ddwrt:amkeyfield="ID" ddwrt:amkeyvalue="ddwrt:EscapeDelims(string(@ID))" ddwrt:ammode="view"></span>
</td>-->
</xsl:if>
<td class="ms-vb">
<b>
<xsl:value-of select="@Title" disable-output-escaping="yes"/>
Posted
<xsl:value-of select="ddwrt:FormatDate(string(@Created), 1033, 5)"/></b>
Effective
<xsl:value-of select="ddwrt:FormatDate(string(@Effective), 1033, 5)"/>
through
<xsl:value-of select="ddwrt:FormatDate(string(@Expires), 1033, 5)"/>
<xsl:value-of select="@Body" disable-output-escaping="yes"/>
</td>
</tr>
<tr>
<td>
<hr></hr>
</td>
</tr>
</xsl:template>
</xsl:stylesheet></Xsl>
</WebPartPages:DataFormWebPart>
</ZoneTemplate></WebPartPages:WebPartZone>
</div>
</div>
<div style="clear:both;"> </div>
</div>
<!-- main content end -->
</asp:Content>
...