Rajkumar R

Rajkumar R

  • NA
  • 26
  • 3.6k

Gridview- Client Side Calculation using javascript

Aug 23 2017 8:27 AM
Hi,
 
I have a gridview with ITEM TEMPLATES for 12 fields, for each collumn set of calculations are there based on rows. Can you please provide me the sample code in JAVASCRIPT
 
LOOP THROUGH THE GRIDVIEW TEXTBOXES AND GET THE VALUE AND DO THE CALCULATION AND SHOW THE RESULT IN ONE OF THE ROWS.
 
Example :
 
If am in Cell 7, will take the value of  Row1 + Row 2 - Row 7 - Row 9  and the total should be shown in Tow 12 of Cell 7 
 
<asp:GridView ID="grdCIP" runat="server" GridLines="both"
AutoGenerateColumns="False"
forecolor="Black"
onrowdatabound="grdCIP_RowDataBound" DataKeyNames="CIP_CategoryId"
onrowcreated="grdCIP_RowCreated">
 
<asp:TemplateField HeaderText="Jan">
<ItemTemplate>
<asp:TextBox ID="txtJan" runat="server" Width="50px" Text='<%# Eval("Jan") %>' > </asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
 

Answers (2)