Demonstrates a complex case based on the Shopping Cart model.
Suppose this is a checkout page where you have placed an order. You enter the quantity,
which is multiplied by the price.
In addition, you use a DropDownList to select between one of three shipping rates.
There are 3 CalculationControllers here. The first calculates the product price
x quantity. It updates row 1.
The second row uses a CalculationController to select between several possible prices
and display its value.
The third row uses a CalculationController to add the value of the first and second
rows.
<table width="500">
<tr class='TableTitles'>
<td width="200">
Product name
</td>
<td width="100">
Price
</td>
<td width="100">
Quantity
</td>
<td width="100">
Total
</td>
</tr>
<tr class="TableRows">
<td>
Computer Desk #5312-30
</td>
<td align="right">
$200.00
</td>
<td>
<des:IntegerTextBox ID="ProductQty1" runat="server" Width="30px" ShowSpinner="True"
MinValue="1" MaxValue="99" AllowNegatives="False">1</des:IntegerTextBox>
</td>
<td align="right">
<des:CalculationController ID="ProductCalc1" runat="server" ShowValueControlID="ProductTotal1"
LabelFormatCurrencySymbol="True" LabelFormatThousandsSep="True" DecimalPlaces="Currency"
AutoShowValue="Always">
<Expression>
<des:ConstantCalcItem Constant="200"></des:ConstantCalcItem>
<des:NumericTextBoxCalcItem TextBoxControlID="ProductQty1" Operator="Multiply"></des:NumericTextBoxCalcItem>
</Expression>
</des:CalculationController>
<asp:Label ID="ProductTotal1" runat="server"></asp:Label>
</td>
</tr>
<tr class="TableRows">
<td>
Shipping
<asp:DropDownList ID="ShippingDDL" runat="server">
<asp:ListItem Value="Overnight">Overnight</asp:ListItem>
<asp:ListItem Value="3 - 5 days">3 - 5 days</asp:ListItem>
<asp:ListItem Value="Standard Ground">Standard Ground</asp:ListItem>
</asp:DropDownList>
</td>
<td>
</td>
<td>
</td>
<td align="right">
<des:CalculationController ID="ShippingCalc" runat="server" ShowValueControlID="ShippingTotal"
LabelFormatCurrencySymbol="True" LabelFormatThousandsSep="True" DecimalPlaces="Currency"
AutoShowValue="Always">
<Expression>
<des:ConditionCalcItem>
<ExpressionWhenTrue>
<des:ConstantCalcItem Constant="12.8"></des:ConstantCalcItem>
</ExpressionWhenTrue>
<ConditionContainer>
<des:SelectedIndexCondition ControlIDToEvaluate="ShippingDDL" >
</des:SelectedIndexCondition>
</ConditionContainer>
<ExpressionWhenFalse>
<des:ConditionCalcItem>
<ConditionContainer>
<des:SelectedIndexCondition ControlIDToEvaluate="ShippingDDL"
Index="1"></des:SelectedIndexCondition>
</ConditionContainer>
<ExpressionWhenTrue>
<des:ConstantCalcItem Constant="8.75"></des:ConstantCalcItem>
</ExpressionWhenTrue>
<ExpressionWhenFalse>
<des:ConstantCalcItem Constant="4.25"></des:ConstantCalcItem>
</ExpressionWhenFalse>
</des:ConditionCalcItem>
</ExpressionWhenFalse>
</des:ConditionCalcItem>
</Expression>
</des:CalculationController>
<asp:Label ID="ShippingTotal" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<b>Total Price</b>
</td>
<td>
</td>
<td>
</td>
<td align="right">
<des:CalculationController ID="TotalCalc" runat="server" ShowValueControlID="PurchaseTotal"
LabelFormatCurrencySymbol="True" LabelFormatThousandsSep="True" DecimalPlaces="Currency"
AutoShowValue="Always">
<Expression>
<des:CalcControllerCalcItem ControlID="ProductCalc1"></des:CalcControllerCalcItem>
<des:CalcControllerCalcItem ControlID="ShippingCalc"></des:CalcControllerCalcItem>
</Expression>
</des:CalculationController>
<asp:Label ID="PurchaseTotal" runat="server"></asp:Label>
</td>
</tr>
</table>