<script runat="server">
public void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
FillInList();
}
public virtual void FillInList()
{
List<string> vData = new List<string>();
vData.Add("1");
vData.Add("2");
vData.Add("3");
GridView1.DataSource = vData;
GridView1.DataBind();
}
public void Button1_Click(object sender, EventArgs e)
{
if (PeterBlum.DES.Globals.WebFormDirector.IsValid)
{
FillInList();
}
}
</script>
This example uses a GridView. Each row has an integertextbox and a CalculationController.<br/>
Two more CalculationControllers are in the footer of the GridView. One totals the
integertextboxes. The other totals the CalculationControllers in the columns.<br/>
Enter numbers into the 3 textboxes. Totals will change as you move focus off the textbox.
<br/>
<br/>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" ShowFooter="true" ShowHeader="false" BorderStyle="Solid" BorderWidth="1" BorderColor="Black">
<Columns>
<asp:TemplateField>
<ItemTemplate>
Integer:
<des:IntegerTextBox ID="IntegerTextBox1" runat="server" IntegerBindable="<%# 1%>"></des:IntegerTextBox>
x 10:
</ItemTemplate>
<FooterTemplate>
Total:
<asp:Label ID="IntegersTotalLabel" runat="server"></asp:Label>
<des:CalculationController ID="CalcIntegersTotal" runat="server" ShowValueControlID="IntegersTotalLabel"
DecimalPlaces="Integer" AutoShowValue="Always">
<Expression>
<des:TotalingCalcItem ControlIDInRow="IntegerTextBox1" ListControlID="GridView1" />
</Expression>
</des:CalculationController>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="TotalLabel" runat="server" /><br/>
<des:CalculationController ID="CalcController1" runat="server" ShowValueControlID="TotalLabel"
DecimalPlaces="Integer" AutoShowValue="Always">
<Expression>
<des:NumericTextBoxCalcItem TextBoxControlID="IntegerTextBox1" />
<des:ConstantCalcItem Constant="10" Operator="Multiply" />
</Expression>
</des:CalculationController>
</ItemTemplate>
<FooterTemplate>
<asp:Label ID="CalcsTotalLabel" runat="server"></asp:Label>
<des:CalculationController ID="CalcsTotalController" runat="server" ShowValueControlID="CalcsTotalLabel"
DecimalPlaces="Integer" AutoShowValue="Always">
<Expression>
<des:TotalingCalcItem ControlIDInRow="CalcController1" ListControlID="GridView1" />
</Expression>
</des:CalculationController>
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<br/>
<des:Button ID="Button1" runat="server" Text="Restart" OnClick="Button1_Click" />