I want to total every row from my listview
tallies total infected people and percentage
__________________________________________________ __________________
CityID | City | Population | Male | Female | Total | Percentage |
Population, male, and female columns are user inputs
total column is male+female textbox value per row
percentage= (total/population)*100 also per row
to calculate total and percentage on every textchange
here is my html code:
Expand|Select|Wrap|Line Numbers
- <asp:ListView ID="ListView1" runat="server">
- <LayoutTemplate>
- <table style="border: solid 2px #336699;" cellspacing="0" cellpadding="3" rules="all">
- <tr style="background-color: #336699; color: White;">
- <th>City</th>
- <th>Population</th>
- <th>Male</th>
- <th>Female</th>
- <th>Total</th>
- <th>%</th>
- </tr>
- <tbody>
- <asp:PlaceHolder ID="itemPlaceHolder" runat="server" />
- </tbody>
- </table>
- </LayoutTemplate>
- <ItemTemplate>
- <tr>
- <td> <asp:Label ID="lblCtyID" runat="server" Text='<%# Bind("CityID") %>' /> </td>
- <td> <asp:Label ID="lblCty" runat="server" Text='<%# Bind("CityName") %>'/> </td>
- <td><asp:TextBox ID="txtPopu" runat="server"/></td>
- <td>
- <asp:TextBox ID="txtMale" runat="server" Width="69px" ValidationGroup="check"/>
- <asp:RegularExpressionValidator ID="RegularExpressionValidator1" Display="Dynamic" runat="server" ForeColor="Maroon" SetFocusOnError="True" ControlToValidate="txtMale" ErrorMessage="X" ValidationExpression="[0-9]*" ValidationGroup="check"></asp:RegularExpressionValidator>
- </td>
- <td><asp:TextBox ID="txtFemale" runat="server" Width="69px" onpaste = "return false;" onkeyup ="keyUP(event.keyCode)" onkeydown = "return isNumeric(event.keyCode);"/></td>
- <td><asp:TextBox ID="txtTotal" runat="server" enabled="false" Width="85px"/></td>
- <td><asp:TextBox ID="txtPercent" runat="server" enabled="false" Width="85px"/></td>
- </tr>
- </ItemTemplate>
- </asp:ListView>
- <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Save Info"
- Width="136px" />
- <br />
- <asp:SqlDataSource ID="SqlDataSource1" runat="server"
- ConnectionString="<%$ ConnectionStrings:GeraldConnString2 %>"
- SelectCommand="SELECT [CityID], [CityName] FROM [Cities]"></asp:SqlDataSource>