locked
Need G.Total On Repeater RRS feed

  • Question

  • User2033107836 posted

    Hello

    This is my complete code in aspx page

    <asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound" DataSourceID="SqlDataSource3">
      
                 <HeaderTemplate>
                  <table>
                   <asp:Repeater ID="Repeater3" runat="server"  OnItemDataBound="Repeater3_ItemDataBound"  DataSourceID="SqlDataSource3" >
                  <AlternatingItemTemplate>
                    <tr>
                    <td>
                                      BatchNo                  <asp:Label ID="BatchNolb" runat="server" Text='<%# Eval("BatchNo") %>' ></asp:Label>                      
                    </td>
                   <td colspan="2"> 
                           XXXXX: <asp:Label ID="LArticle" runat="server" Text='<%# Eval("XXXXX ") %>' ></asp:Label> 
                          </td>
                            <td > 
                           YYYYY: <asp:Label ID="LShade" runat="server" Text='<%# Eval("YYYYY ") %>' ></asp:Label> 
                          </td>
                           <td > 
                              
                           Pcs: <asp:Label ID="Label6" runat="server" Text='<%# Eval("Pcs") %>' ></asp:Label> 
                                             
                          </td>
                          
                    </tr>
                    
                    <tr>
                    <td colspan="3">
                   <span style="color: Teal; font-family: Palatino Linotype"><strong>
                       Cost Per Piece:</strong></span>
                      <asp:Label ID="CostPerSqft" runat="server"  ></asp:Label>                      
                    </td>
                  
                    </tr>
              </AlternatingItemTemplate>
                   
                    </asp:Repeater> 
                               
                 </HeaderTemplate>
                 <ItemTemplate>  
                      
                     <tr>
                              <td> 
                             <span style="color: Teal;font-family: Palatino Linotype"><strong>
                           Category: </strong></span><asp:Label ID="Label5" runat="server" Text='<%# Eval("Category") %>'  ></asp:Label> 
                         
                             
                              </td>    
                        
                           
                            <td colspan="2"> 
                            
                                                  Date: <asp:Label ID="Label11" runat="server" Text='<%# Eval("Date", "{0:dd-MMM-yyyy}") %>'  ></asp:Label> 
                          
                              </td>
                     <td colspan="2"> 
                  
                           Link: 
                           <asp:Label ID="Label10" runat="server" Text='<%# Eval("Link") %>'  ></asp:Label> 
                           
                              </td>
                          
                   
                     </tr>
                      
                     
                   
                             <asp:Repeater ID="Repeater2" runat="server"  OnItemDataBound="Repeater2_ItemDataBound">
                             <HeaderTemplate>
                             <tr >
                             <th>Item Name</th>                         
                             <th>Rate</th>
                             <th>Qty</th>
                             <th>Amount</th>
                             
                         </tr>  
                             </HeaderTemplate>
                                 <ItemTemplate>
                                     <tr>
                                         <td>
                                            <%# Eval("ChemicalName") %> 
                                         </td>
                                        
                                         <td style="text-align: right;">
                                          
                                             <asp:Label ID="LR" runat="server" Text='<%# Eval("Rate") %>'></asp:Label> 
                                         </td>
                                         <td style="text-align: right;">
                                             <asp:Label ID="LQ" runat="server" Text='<%# Eval("Qty") %>' style="text-align: right;"></asp:Label> 
                                         </td>
                                         <td style="text-align: right;">
                                         
                                           <asp:Label ID="Label3" runat="server" Text='<%# ((Eval("Qty")!= DBNull.Value ? Convert.ToDouble(Eval("Qty")) : 0) * (Eval("Rate")!= DBNull.Value ? Convert.ToDouble(Eval("Rate")) : 0)).ToString()%>'></asp:Label>
                                         </td>
                                         
                                         
                                        
                                     </tr>
                                 </ItemTemplate>
                                 <FooterTemplate>
                                     <tr>
                                     <td>
                                     </td>
                                       <td> 
                           Total For Each Category:                      </td>
                          <td style="text-align: right;"> 
                             <asp:Label ID="FQty" runat="server"></asp:Label> 
                          </td>
                            <td style="text-align: right;"> 
                             <asp:Label ID="FAmount" runat="server"></asp:Label> 
                          </td>
                          <td > 
                          </td>
                          <td > 
                          </td>
                                     </tr>
                                </FooterTemplate>
                             </asp:Repeater>                                              
                </ItemTemplate>
                
             </asp:Repeater>
            
    

    For example on load it showing 2 category it comes more based on my data

    1 category total FAmount: 200

    2 category total FAmount :300

    Repeater3 Pcs Label shows for example 10

    I want to show Grand Total : 500 

    then in CostPerSqft = 500 / 10 = 50

    how to do using asp.net 2.0 C#

    Saturday, August 12, 2017 5:46 PM

Answers

All replies