An report control.
By changing the values of the control's properties in the SitePages.config file for your Site, you can enable or disable certain behaviors, set certain defaults, alter aspects of the display or otherwise cusomtize your site's implementaion of the control.
The following describes properties pertaining to key functional areas of the control that can be configured to suit your needs.
There are two properties which can be edited to customize this control. The DefaultFamily property is the first of these properties and is responsible for setting the default family. The other property is the DefaultSort property which sets the default sort.
Properties Inherited from the Base CyberStoreBaseControl
Properties specific to the CyberStoreBaseControl can be listed in the following categories:
- Override Properties
- Contextual Properties
Override Properties
When the IgnoreControl property is set to true, all processing of a control is skipped, and the control's Visible property is set to false ensuring that it is not rendered in the resulting CyberStore page.
Contextual Properties
Contextual properties define specific details about the current instance of the control based on context. Context can be set by any number of factors including the log in state of the Shopper, the Site being visited, or the properties that have been established for a control.
The AttributesBag property is used internal to control processing and is the collection of attributes, or properties, and their values based on how the control is configured. The attributes in this property are set by processing the SitePages.config file as well as any specific declared property values in any registered sub controls. It allows for the passing down of all properties to a control and any registered sub controls.
The ComConfig, UserData and Site_ID properties are read-only values made available to all CyberStore controls to aid in processing and establishing context about the Site and Shopper.
See an example of how to configure this control in SitePages.config.
<Control src="ItemReportControl.ascx"
DefaultFamily="Specifications"
DefaultSort=""
/>
The following is the markup for this control.
Developer's Note:
To create a custom version of the control, copy all of the code below into a file of the same name and place it into your Site's control folder (e.g., ../YourSiteFolder/Control). The CyberStore page engine will then override the default markup with your customized version.
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ItemReportControl.ascx.cs"
Inherits="Dovetail.Ecommerce.Controls.ItemReportControl" %>
<link type="text/css" rel="Stylesheet" href="site/themes/css/tipsy.css" />
<script type="text/javascript" src="site/themes/js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="site/themes/js/jquery.tipsy.js"></script>
<script type="text/javascript">
var preventSort = false;
var lastSelectedCategory = '';
var lastSelected1 = '';
var lastSelected2 = '';
var selectedFilterValues = '';
function buildFilter() {
selectedFilterValues = '';
if (lastSelectedCategory != '' || lastSelectedCategory != undefined) {
if (selectedFilterValues != '') {
selectedFilterValues += ' AND ';
}
selectedFilterValues += lastSelectedCategory;
}
if (lastSelected1 != '') {
if (selectedFilterValues != '') {
selectedFilterValues += ' AND ';
}
selectedFilterValues += lastSelected1;
}
if (lastSelected2 != '') {
if (selectedFilterValues != '') {
selectedFilterValues += ' AND ';
}
selectedFilterValues += lastSelected2;
}
if (selectedFilterValues != '') {
ASPxGridView1.ApplyFilter(selectedFilterValues);
}
else { ASPxGridView1.ClearFilter(); }
}
jQuery(document).ready(function () {
$('.tips').tipsy({ html: true });
});
</script>
<div class="FilterBlock">
<dx:ASPxComboBox ID="filterBox1" CssClass="TopFilterBox" runat="server" Native="true"
Height="13">
<ClientSideEvents DropDown="function(s,e){
preventSort = true;
}" CloseUp="function(s,e){
preventSort = false;
}" ValueChanged="function(s,e){
lastSelected1 = s.GetValue();
buildFilter();
}" Init="function(s,e) {
s.InsertItem(0, 'Specification | Weight', '');
if (lastSelected1!='')
{
s.SetValue(lastSelected1);
}
}" />
<Items>
<dx:ListEditItem Text="Above 10 Pounds " Value="[Specifications/Weight] >= 10" />
<dx:ListEditItem Text="Above 20 Pounds " Value="[Specifications/Weight] >= 20" />
<dx:ListEditItem Text="Above 30 Pounds " Value="[Specifications/Weight] >= 30" />
<dx:ListEditItem Text="Above 40 Pounds " Value="[Specifications/Weight] >= 40" />
<dx:ListEditItem Text="Above 50 Pounds " Value="[Specifications/Weight] >= 50" />
</Items>
</dx:ASPxComboBox>
<dx:ASPxComboBox ID="filterBox2" CssClass="TopFilterBox" runat="server" Native="true"
Height="13">
<ClientSideEvents DropDown="function(s,e){
preventSort = true;
}" CloseUp="function(s,e){
preventSort = false;
}" ValueChanged="function(s,e){
lastSelected2 = s.GetValue();
buildFilter();
}" Init="function(s,e) {
s.InsertItem(0, 'Specification | Height', '');
if (lastSelected2!='')
{
s.SetValue(lastSelected2);
}
}" />
<Items>
<dx:ListEditItem Text="Above 24 inches" Value="[Specifications/Height] >= 24" />
<dx:ListEditItem Text="Above 26 inches" Value="[Specifications/Height] >= 26" />
<dx:ListEditItem Text="Above 28 inches" Value="[Specifications/Height] >= 28" />
<dx:ListEditItem Text="Above 30 inches" Value="[Specifications/Height] >= 30" />
</Items>
</dx:ASPxComboBox>
</div>
<div class="DB_Table">
<dx:ASPxGridView ID="ASPxGridView1" runat="server" Font-Size="10px" ClientInstanceName="ASPxGridView1"
OnCustomUnboundColumnData="ASPxGridView1_CustomUnboundColumnData" OnCustomCallback="ASPxGridView1_CustomCallback"
EnableRowsCache="true" EnableViewState="false" EnableCallbackCompression="true">
<Columns>
<dx:GridViewBandColumn>
<HeaderTemplate>
<div>
<span style="float: left; font-weight: bold; margin-right: 15px; margin-top: 5px;">Category
Filter</span>
<dx:ASPxComboBox ID="ASPxComboBox1" runat="server" OnInit="ASPxComboBox1_Init" TextField="Name"
ValueField="ID">
<ClientSideEvents DropDown="function(s,e){
preventSort = true;
}" CloseUp="function(s,e){
preventSort = false;
}" ValueChanged="function(s,e){
ASPxGridView1.AutoFilterByColumn('Category_ID', s.GetValue());
lastSelected1 = s.GetValue();
}" Init="function(s,e) {
s.SetValue(lastSelected1);
}" />
</dx:ASPxComboBox>
</div>
</HeaderTemplate>
<Columns>
<dx:GridViewDataColumn FieldName="StockCode" Name="StockCode" FixedStyle="Left" Width="150px" SortOrder="Ascending">
<HeaderCaptionTemplate>
<img width="30px" height="2px" src="site/images/spacer.gif" /><br />
Stock Code</HeaderCaptionTemplate>
</dx:GridViewDataColumn>
<dx:GridViewDataColumn FieldName="Name" Name="Name" FixedStyle="Left" Width="150px">
<HeaderCaptionTemplate>
<img width="30px" height="2px" src="site/images/spacer.gif" /><br />
Item Name</HeaderCaptionTemplate>
</dx:GridViewDataColumn>
<dx:GridViewDataHyperLinkColumn CellStyle-HorizontalAlign="Center" FieldName="Blah"
Name="BlahName" Width="70px" PropertiesHyperLinkEdit-Style-Border-BorderColor="Red"
PropertiesHyperLinkEdit-Style-Border-BorderStyle="Solid" PropertiesHyperLinkEdit-Style-Border-BorderWidth="1px">
<HeaderCaptionTemplate>
<img width="1px" height="2px" src="site/images/spacer.gif" /><br />
LINK</HeaderCaptionTemplate>
<DataItemTemplate>
<dx:ASPxHyperLink ID="ASPxHyperLink" runat="server" ClientIDMode="AutoID" NavigateUrl='<%# Eval("Link1") %>'
Visible='<%# !((string)Eval("Link1") == "") %>' Text="Link" BackgroundImage-ImageUrl="../../site/images/msds.png" />
</DataItemTemplate>
</dx:GridViewDataHyperLinkColumn>
</Columns>
</dx:GridViewBandColumn>
<dx:GridViewDataColumn FieldName="Category_ID" Visible="false">
</dx:GridViewDataColumn>
<dx:GridViewDataColumn FieldName="Specifications/Weight" UnboundType="Decimal">
</dx:GridViewDataColumn>
<dx:GridViewDataColumn FieldName="Specifications/Length" UnboundType="Decimal">
</dx:GridViewDataColumn>
<dx:GridViewDataColumn FieldName="Specifications/Height" UnboundType="Decimal">
</dx:GridViewDataColumn>
<dx:GridViewDataColumn FieldName="Specifications/Wheelbase" UnboundType="Decimal">
</dx:GridViewDataColumn>
<dx:GridViewDataColumn FieldName="Specifications/Color" UnboundType="String">
</dx:GridViewDataColumn>
<dx:GridViewDataColumn FieldName="Specifications/Gears" UnboundType="Integer">
</dx:GridViewDataColumn>
</Columns>
<Settings ShowHorizontalScrollBar="false" ShowVerticalScrollBar="false" ShowFilterRow="false"
ShowFilterBar="Auto" ShowFilterRowMenu="false" />
<SettingsPager AlwaysShowPager="true" Mode="ShowPager" PageSize="18" />
<SettingsCookies StoreColumnsVisiblePosition="false" />
<SettingsBehavior AllowDragDrop="false" AllowFocusedRow="false" AllowGroup="false"
AllowSelectByRowClick="false" AllowSelectSingleRowOnly="false" AllowSort="true" />
<Styles>
<Cell Font-Size="10px">
</Cell>
<AlternatingRow Enabled="true" />
</Styles>
<ClientSideEvents BeginCallback="function(s,e) {
if(e.command == 'APPLYFILTER') {
}
}" EndCallback="function(s,e) {
$('.tips').tipsy({ html: true });
}" ColumnSorting="function(s,e) {
if(preventSort) {
e.cancel = true;
preventSort = false;
}
}" />
<Templates>
<HeaderCaption>
<div class="verticalitemmaterialdiv">
<img src="/Ecommerce/site/themes/images/questionmark.gif" class="questionmark" class="tips"
width="15px" title='<%# GetHelpText(Eval("FieldName"))%>' />
<span class="verticalmaterialtext">
<%# GetLabelText(Eval("FieldName")) %></span>
</div>
</HeaderCaption>
</Templates>
</dx:ASPxGridView>
</div>
<div class="DB_FilterButtons">
<dx:ASPxButton ID="ASPxButton1" ClientInstanceName="ASPxButton1" runat="server" Text="Specifications"
UseSubmitBehavior="false" AutoPostBack="false" Image-Url="~/site/images/buttons/Specifications_btn.png"
Image-AlternateText="Specifications" Image-UrlDisabled="~/site/images/buttons/Specifications_btn_current.png">
<ClientSideEvents Init="function(s,e) {
if(ASPxButton2.GetEnabled && ASPxButton3.GetEnabled)
{
ASPxButton1.SetEnabled(false);
}
}" Click="function() {
ASPxButton1.SetEnabled(false);
ASPxButton2.SetEnabled(true);
ASPxButton3.SetEnabled(true);
ASPxGridView1.PerformCallback('Specifications');
}" />
</dx:ASPxButton>
<dx:ASPxButton ID="ASPxButton2" ClientInstanceName="ASPxButton2" runat="server" Text="Other - 1"
UseSubmitBehavior="false" AutoPostBack="false" Image-Url="~/site/images/buttons/Other1_btn.png"
Image-AlternateText="Other - 1" Image-UrlDisabled="~/site/images/buttons/Other1_btn_current.png">
<ClientSideEvents Init="function(s,e) {
if(ASPxButton1.GetEnabled && ASPxButton3.GetEnabled)
{
ASPxButton2.SetEnabled(false);
}
}" Click="function() {
ASPxButton1.SetEnabled(true);
ASPxButton2.SetEnabled(false);
ASPxButton3.SetEnabled(true);
ASPxGridView1.PerformCallback('Other - 1');
}" />
</dx:ASPxButton>
<dx:ASPxButton ID="ASPxButton3" ClientInstanceName="ASPxButton3" runat="server" Text="Other - 2"
UseSubmitBehavior="false" AutoPostBack="false" Image-Url="~/site/images/buttons/Other2_btn.png"
Image-AlternateText="Other - 2" Image-UrlDisabled="~/site/images/buttons/Other2_btn_current.png">
<ClientSideEvents Init="function(s,e) {
if(ASPxButton1.GetEnabled && ASPxButton2.GetEnabled)
{
ASPxButton3.SetEnabled(false);
}
}" Click="function() {
ASPxButton1.SetEnabled(true);
ASPxButton2.SetEnabled(true);
ASPxButton3.SetEnabled(false);
ASPxGridView1.PerformCallback('Other - 2');
}" />
</dx:ASPxButton>
</div>