<%@ Control Language="C#" Inherits="PeterBlum.DES.BLD.PartsPatternTemplate" Usage="Filters" %>
<script runat="server">
protected const string cCssContainer = "FilterViewContainer";
protected const string cCssLabelContainer = "FilterLabelContainer";
protected const string cCssFilterContainer = "FilterContainer";
protected const string cCssLabelControl = "FilterLabelControl";
protected const string cCssRow = "FilterRow";
protected const string cCssHeaderRow = "FilterHeaderRow";
protected const string cCssButtonsContainer = "FilterButtonsContainer";
protected const string cCssNoDataToShow = "FilterNoDataToShow";
protected const string cCssFooterRow = "";
public string HeaderLabelContainerHTML
{
get { return GetPropertyFromHost<String>("HeaderLabelContainerHTML", cDefaultHeaderLabelContainerHTML); }
}
private const string cDefaultHeaderLabelContainerHTML = "Name";
public override BLDPartsPatternTemplate GetBLDPartsPatternTemplate()
{
return BLDPartsPatternTemplate1;
}
private void BLDFilterField1_OnDataBinding(object pSender, EventArgs e)
{
BLDLabel vBLDLabel = (BLDLabel) pSender;
vBLDLabel.CssClass = GetPropertyFromItemInPattern<string>(vBLDLabel, "LabelCssClass", cCssLabelControl);
}
protected void BLDFilterField_FilterHidden(object pSender, EventArgs pArgs)
{
if (((BLDFilterField)pSender).DisplayMode == BLDFilterFieldDisplayMode.Hidden)
{
Control vContentContainer = ((Control) pSender).Parent.Parent;
foreach (Control vControl in vContentContainer.Controls)
{
if (vControl is HtmlTag)
((HtmlTag)vControl).Style.Add("display", "none");
else
vControl.Visible = false;
}
fFilterHiddenCount++;
if (fFilterHiddenCount == fFilterCount)
{
HtmlTag vTrContainer = this.GetContainerHtmlTag((Control) pSender, BLDPartsPatternTemplate1.Container.GetTagKey());
if (vTrContainer != null)
{
vTrContainer.Style.Add("display", "none");
}
}
}
}
protected void BLDFilterField_Load(object pSender, EventArgs pArgs)
{
fFilterCount++;
if (((BLDFilterField)pSender).HasFilterHidden() && (((BLDFilterField)pSender).DisplayMode == BLDFilterFieldDisplayMode.Hidden))
{
Control vContentContainer = ((Control) pSender).Parent.Parent;
foreach (Control vControl in vContentContainer.Controls)
{
if (vControl is HtmlTag)
((HtmlTag)vControl).Style.Remove("display");
else
vControl.Visible = true;
}
HtmlTag vTrContainer = this.GetContainerHtmlTag((Control) pSender, BLDPartsPatternTemplate1.Container.GetTagKey());
if (vTrContainer != null)
vTrContainer.Style.Remove("display");
}
}
private int fFilterCount = 0;
private int fFilterHiddenCount = 0;
</script>
<des:BLDPartsPatternTemplate ID="BLDPartsPatternTemplate1" runat="server" MaxCellsPerRow="3">
<Container Tag="Table" NamedStyle="Container" CssClass="<%# cCssContainer%>" GenerateID="true" cellspacing="0" />
<DataRow Tag="Tr" NamedStyle="Row" CssClass="<%# cCssRow%>"/>
<DataCell Tag="None" UseContainerTagAttributes="true" >
<Template>
<des:HtmlTag runat="server" Tag="Td" CssClass="<%# cCssLabelContainer%>" NamedStyle="LabelContainer" >
<des:BLDLabel ID="BLDLabel1" runat="server" AssociatedControlID="BLDFilterField1"
EnableViewState="false" CssClass="<%# cCssLabelControl%>"
OnDataBinding="BLDFilterField1_OnDataBinding" />
<des:NamedStylesExtender ID="BLDLabel1Extender" runat="server"
NamedStyle="LabelControl" ControlIDToExtend="BLDLabel1" />
</des:HtmlTag>
<des:HtmlTag runat="server" Tag="Td" CssClass="<%# cCssFilterContainer%>" NamedStyle="FilterContainer"
ConvertScaleToColSpan="1" >
<des:BLDFilterField ID="BLDFilterField1" runat="server"
OnFilterHidden="BLDFilterField_FilterHidden" OnLoad="BLDFilterField_Load" />
<%-- NOTE: Filter Templates support Named Styles for their child controls --%>
</des:HtmlTag>
</Template>
</DataCell>
<%-- Creates a one cell header ---%>
<HeaderRow Tag="Tr" NamedStyle="HeaderRow" NamedStyleFallback="Row" CssClass="<%# cCssHeaderRow%>" >
<Template>
<des:HtmlTag runat="server" Tag="Td"
NamedStyle="HeaderLabelContainer" NamedStyleFallback="LabelContainer" ColSpan="999" >
<des:LocalizableLabel ID="HdrLbl1" runat="server" Text="<%# HeaderLabelContainerHTML%>" />
</des:HtmlTag>
</Template>
</HeaderRow>
<%-- Buttons are shown in a single cell --%>
<%-- The PatternTemplates used to not establish their own container tag. --%>
<Buttons Tag="Td" NamedStyle="ButtonRow" NamedStyleFallback="Row"
CssClass="<%# cCssButtonsContainer%>" ColSpan="999"
PatternTemplateName="LinkButtonsForFilters" >
<NamedParts>
<des:ButtonsNamedPatternPart Name="LinkButtons"
PatternTemplateName="LinkButtonsForFilters" />
<des:ButtonsNamedPatternPart Name="Buttons"
PatternTemplateName="ButtonsForFilters" />
<%-- These two NamedParts require the AjaxControlToolkit and the folder specified here. --%>
<des:ButtonsNamedPatternPart Name="LinkButtonsWithAdvancedSearch"
PatternTemplateName="LinkButtonsForFilters with Advanced Search"
PatternTemplatesFolderUrl="~/BLD Templates/FilterPatternTemplates/Ajax Control Toolkit/"/>
<des:ButtonsNamedPatternPart Name="ButtonsWithAdvancedSearch"
PatternTemplateName="ButtonsForFilters with Advanced Search"
PatternTemplatesFolderUrl="~/BLD Templates/FilterPatternTemplates/Ajax Control Toolkit/" />
</NamedParts>
</Buttons>
<FooterRow Tag="Tr" NamedStyle="FooterRow" NamedStyleFallback="Row" CssClass="<%# cCssFooterRow%>" >
<Template>
<des:HtmlTag ID="HtmlTag1" runat="server" Tag="Td" ColSpan="999" >
</des:HtmlTag>
</Template>
</FooterRow>
<%--
<EmptyItemCell Tag="Td" ColSpan="2" NamedStyle="EmptyItemCell" NamedStyleFallback="DataCell" >
<Template>
</Template>
</EmptyItemCell>
--%>
<EmptyItemCell Tag="None" >
<Template>
<des:HtmlTag runat="server" Tag="Td"
CssClass="<%# cCssFilterContainer%>" NamedStyle="EmptyColumn" >
</des:HtmlTag>
<des:HtmlTag runat="server" Tag="Td"
CssClass="<%# cCssFilterContainer%>" NamedStyle="EmptyColumn" >
</des:HtmlTag>
</Template>
</EmptyItemCell>
</des:BLDPartsPatternTemplate>