Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8378139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:51:31+00:00 2026-06-09T15:51:31+00:00

I have a nested gridview: <gridview id=gvParent runat=server > <Columns> <asp:TemplateField> <ItemTemplate> <asp:Label Id=name

  • 0

I have a nested gridview:

<gridview id="gvParent" runat="server" >
  <Columns>
    <asp:TemplateField>
     <ItemTemplate>
       <asp:Label Id="name" runat="server" Text='<%# Eval("Name")%>' />

        <gridview id="gvChild" runat="server" >
          <Columns>
           <asp:TemplateField>
            <ItemTemplate>
            <input type="text" id="Val1'<%# Eval("Identifiant")%>'" value='<%# Eval("Val1">' onchange=  "CalculateSumRow(Val2'<%# Eval("Identifiant")%>');"/>

           </ItemTemplate>
          </asp:TemplateField>

        <gridview id="gvChild" runat="server" >
          <Columns>
           <asp:TemplateField>
            <ItemTemplate>
       <input type="text" id="Val2'<%# Eval("Identifiant")%>'" value='<%# Eval("Val2")%>' onchange="CalculateSumRow(Val2'<%# Eval("Identifiant")%>');"/>

           </ItemTemplate>
          </asp:TemplateField>



         <asp:TemplateField>
          <ItemTemplate>
            <input type="text" id="TotalRealise<%# Eval("Identifiant")%>'" value='<%# Eval       ("TotalRealise")%>'/>

            </ItemTemplate>
          </asp:TemplateField>


      </Columns>

    </gridview>

    </ItemTemplate>
  </asp:TemplateField>
  </Columns>

In javascript function CalculateSumRow I make sum of val1 and val 2 per row in field TotalRealise and I need a total of fields TotalRealise.I try to make a javascript function that I called from CalculateSumRow .I try to parse row by row first grid , then second grid and I want to get all totalrealise fields and make a sum with this but I receive errors when I search the second grid.I want to make that calculation from javascript.

 function CalculateSumRow (identifiant)
 {
   ......
  CalculateTotal();
 }

 function CalculateTotal()
 {
   var grdPar=document.getdocumentById('<%= gvParent%>');

   for(row=1;row<grdPar.rows.length;row++)
   {

      var grdChild=document.getdocumentById('<%= gvChild%>');

      for(rowC=1;row<grdChild.rows.length;rowC++)
       {
         alert(grdChild.rows[rowc].cell[3].value);
       }

    }
   }

Can somebody help me make this sum ?
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T15:51:32+00:00Added an answer on June 9, 2026 at 3:51 pm

    If you are comfortable using jQuery, try this:

    $(function(){
      var sum = 0;
      $("input[id^="TotalRealise"]").each(function(){
        sum = sum + parseFloat($(this).val());
      });
    });
    

    Call the below function onchange event of input value:

    function CalculateTotalRealise()
    {
     var sum = 0;
      $("input[id^="TotalRealise"]").each(function(){
        sum = sum + parseFloat($(this).val());
      });
     return sum;
    }
    

    This will give you sum of TotalRealise fields.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have defined a nested grid view in the following way. <asp:GridView ID=GridView1 runat=server
I have GridView and Button controls nested inside a Panel . <asp:Panel ID=PanelPopUp runat=server>
I have an ASP Datalist with a nested GridView. I am trying to display
I have a radiobutton column in a gridview, inside many nested asp tables. I
I have a grid view with a nested text box in it. I would
I have a Repeater nested inside of a GridView . On the RowDataBound event
I have a nested GridView that is placed inside a ListView. The GridView renders
I have a simple situation that does not work. Gridview is nested inside updatepanel
I have come across odd behavior involving nested gridview controls and row events. Basically
How can i give background color to my child gridview's cell?? I have nested

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.