Language preference:

Phase 6: Source code files

What to look for

Changes to ~/BLD Templates/CustomPages_Phase6/Orders/List.aspx

  • The Order list offers a Select button in the BLDDataButtons control. It runs scripts to popup a list of products ordered using the ModalPopupExtender control.
  • This interface now has three Databound controls and associated EntityDAODataSource controls, where the selected order is used to create a filter that selects the appropriate Order Details records.

Changes to ~/BLD Templates/PageTemplates_Phase6/List.aspx

  • The filter buttons include "Advanced" which options an Ajax Control Toolkit ModalPopupExtender with a BLDPatternForFilterFields control that shows all filters provided by the business logic through Automatic Scaffolding. This button's code is included with BLD, in the ~/BLD Templates/FilterPatternTemplates/Ajax Control Toolkit/Advanced Search.ascx User Control.
  • The BLDPatternForFilterFields control has been formatted by using Named Styles and HTML around it to form an outer container that fits the width of the page, while leaving the Filters Rows Format.ascx Pattern Template file unchanged.
Global.asax
<%Control Language="C#" Inherits="PeterBlum.DES.BLD.PartsPatternTemplate" Usage="Filters" %>

<script runat="server">
/* ---- USAGE ------------------------------------------------------------- For use with BLDPatternForFilterFields control to display all columns and the buttons for a filter interface. Creates a table with one row containing the columns. The row generates this HTML: <tr> <td>[BLDLabel for column1]</td> <td>[BLDFilterField for column1]</td> <td>[BLDLabel for column2]</td> <td>[BLDFilterField for column2]</td> [more] </tr> If MaxCellsInRows is reached, a new row is started using </tr><tr>. Its overall Container is the <table> tag. A one-cell row header is optional, depending on if you specify it in BLDPatternForFilterFields.PartsToGenerate. Its label is defined in the HeaderLabelContainerHTML property. Example: <des:BLDPatternForFilterFields ID="BLDPattern1" runat="server" PatternTemplateName="Filter Rows Format" MaxCellsInRows="3" > </des:BLDPatternForFilterFields> ---- NAMED STYLES ------------------------------------------------------ Use the BLDPatternForFilterFields.NamedStyles property to declare any of these style names. REMINDER: Filter Templates handle NamedStyles for controls they contain. Container - Style for the container tag around the entire data bound control. LabelContainer - Style for the first column (TD tag), containing the label. LabelControl - Style for any BLDLabel control FilterContainer - Style for the second column (TD tag), containing the Filter. FilterTemplateDataControls - Filter Templates defined their own Named Styles. This is the default for the data entry control. It may differ based on your Filter Template definitions. Row - Style for the TR tag enclosing one Label+FilterContainer. HeaderRow - Style for the optional column headers. ButtonsContainer - Style around the buttons. NoDataToShow - Style for the content displayed when there is no data to show For example: <des:BLDPatternForFilterFields ID="BLDPattern1" runat="server" PatternTemplateName="Filter Rows Format" > <NamedStyles> <des:NamedStyle Name="LabelContainer" CssClass="MyClass" /> <des:NamedStyle Name="FilterContainer" Style="width:100px;" /> </NamedStyles> </des:BLDPatternForFilterFields> --- XML FORMAT OF NAMED STYLES ---------------------------------------- Design mode uses this XML format. <NamedStylesDoc> <NamedStyle Name="Container">Style for the container tag around the entire control.</NamedStyle> <NamedStyle Name="LabelContainer">Style for the first column (TD tag), containing the label.</NamedStyle> <NamedStyle Name="LabelControl">Style for the BLDLabel control.</NamedStyle> <NamedStyle Name="FilterContainer">Style for the second column(TD tag), containing the Filter.</NamedStyle> <NamedStyle Name="FilterTemplateDataControls">Filter Templates defined their own Named Styles. This is the default for the data entry control. It may differ based on your Filter Template definitions.</NamedStyle> <NamedStyle Name="Row">Style for the TR tag enclosing one Label+FilterContainer.</NamedStyle> <NamedStyle Name="HeaderRow">Style the optional column headers.</NamedStyle> <NamedStyle Name="ButtonsContainer">Style around the buttons</NamedStyle> <NamedStyle Name="NoDataToShow">Style for the content displayed when there is no Filters to show.</NamedStyle> </NamedStylesDoc> // --- DEFAULT STYLE SHEET CLASSES ---------------------------------- Assign the default style sheet class names for the parts of this PatternTemplate here. Declare these classes in the style sheet file ~/DynamicData/Content/PatternTemplateNamedStyles.css. Each item here is associated with a Named style above. */ 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 = ""; // --- PROPERTIES --------------------------------------------------- /// <summary> /// When using the Header row, it shows this text in the first column by default. /// </summary> /// <remarks> /// <para>Feel free to modify or completely replace the LocalizableLabel of this element /// with your preferred interface.</para> /// </remarks> public string HeaderLabelContainerHTML { get { return GetPropertyFromHost<String>("HeaderLabelContainerHTML", cDefaultHeaderLabelContainerHTML); } } private const string cDefaultHeaderLabelContainerHTML = "Name"; // --- METHODS ------------------------------------------------------ public override BLDPartsPatternTemplate GetBLDPartsPatternTemplate() { return BLDPartsPatternTemplate1; } /// <summary> /// Allows the BLDFilterField to have a style sheet defined in the ItemInPattern object /// as an attribute named LabelCssClass. /// </summary> /// <param name="pSender"></param> /// <param name="e"></param> 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) // write it out so the HTML form fields will post back their current values ((HtmlTag)vControl).Style.Add("display", "none"); else vControl.Visible = false; } fFilterHiddenCount++; if (fFilterHiddenCount == fFilterCount) // hide the UL container { 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++; // The ViewState preserves the Style and Visible properties set in BLDFilterField_FilterHidden // Undo those settings. 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) // write it out so the HTML form fields will post back their current values ((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"); } // if HasFilterHidden } 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>