Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. total and subtotal in gridview footer

total and subtotal in gridview footer

Scheduled Pinned Locked Moved ASP.NET
sysadmin
13 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RajpootRohan
    wrote on last edited by
    #1

    Hello friends, I have to display subtotal, vat,total in gridview footer. I am doing like this but nothing is displayed. <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" Font-Names="Verdana" Font-Size="Small" ForeColor="#333333" PageSize="900" Width="600px" EmptyDataText="No items in your cart!!" DataKeyNames="REF" GridLines="None" ShowFooter="True" onrowdatabound="GridView1_RowDataBound"> <FooterStyle BackColor="#1C5E55" ForeColor="#FFFFFF" Font-Bold="True" /> <RowStyle BackColor="#E3EAEB" /> <Columns> <asp:BoundField DataField="REF" HeaderText="REF" SortExpression="REF" ItemStyle-Width="60px" > <ItemStyle Width="60px"></ItemStyle> </asp:BoundField> <asp:TemplateField HeaderText="product_id" Visible="False"> <ItemTemplate> <asp:Label ID="lblProduct_Id" runat="server" Text='<%# Eval("REF") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" ItemStyle-Width="300px" > <ItemStyle Width="300px"></ItemStyle> </asp:BoundField> <asp:TemplateField HeaderText="Description" Visible="False"> <ItemTemplate> <asp:Label ID="lblDescription" runat="server" Text='<%# Eval("Description")%>' ></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="QTY"> <ItemTemplate> <asp:TextBox ID="TxtQTY" runat="server" Width="30px" Text='<%# Eval("QTY") %>' /> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" ItemStyle-Width="80px" > <ItemStyle Width="80px"></ItemStyle> </asp:BoundField> <asp:TemplateField HeaderText="Price" Visible="False"> <ItemTemp

    N 3 Replies Last reply
    0
    • R RajpootRohan

      Hello friends, I have to display subtotal, vat,total in gridview footer. I am doing like this but nothing is displayed. <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" Font-Names="Verdana" Font-Size="Small" ForeColor="#333333" PageSize="900" Width="600px" EmptyDataText="No items in your cart!!" DataKeyNames="REF" GridLines="None" ShowFooter="True" onrowdatabound="GridView1_RowDataBound"> <FooterStyle BackColor="#1C5E55" ForeColor="#FFFFFF" Font-Bold="True" /> <RowStyle BackColor="#E3EAEB" /> <Columns> <asp:BoundField DataField="REF" HeaderText="REF" SortExpression="REF" ItemStyle-Width="60px" > <ItemStyle Width="60px"></ItemStyle> </asp:BoundField> <asp:TemplateField HeaderText="product_id" Visible="False"> <ItemTemplate> <asp:Label ID="lblProduct_Id" runat="server" Text='<%# Eval("REF") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" ItemStyle-Width="300px" > <ItemStyle Width="300px"></ItemStyle> </asp:BoundField> <asp:TemplateField HeaderText="Description" Visible="False"> <ItemTemplate> <asp:Label ID="lblDescription" runat="server" Text='<%# Eval("Description")%>' ></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="QTY"> <ItemTemplate> <asp:TextBox ID="TxtQTY" runat="server" Width="30px" Text='<%# Eval("QTY") %>' /> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" ItemStyle-Width="80px" > <ItemStyle Width="80px"></ItemStyle> </asp:BoundField> <asp:TemplateField HeaderText="Price" Visible="False"> <ItemTemp

      N Offline
      N Offline
      Nishant Singh
      wrote on last edited by
      #2

      Hi Sneha you need to basically debug the GridView1_RowDataBound function. In my opinion

      Label lblSubTotal = (Label)e.Row.Cells[4].FindControl("lblSubTotal");

      R U 2 Replies Last reply
      0
      • N Nishant Singh

        Hi Sneha you need to basically debug the GridView1_RowDataBound function. In my opinion

        Label lblSubTotal = (Label)e.Row.Cells[4].FindControl("lblSubTotal");

        R Offline
        R Offline
        RajpootRohan
        wrote on last edited by
        #3

        thanks for the reply Nishant. I did what you said but didn't get the results. On debugging the label control is showing the value but not in the browser. Unable to sort out the problem.

        cheers, sneha

        1 Reply Last reply
        0
        • N Nishant Singh

          Hi Sneha you need to basically debug the GridView1_RowDataBound function. In my opinion

          Label lblSubTotal = (Label)e.Row.Cells[4].FindControl("lblSubTotal");

          U Offline
          U Offline
          User 4216075
          wrote on last edited by
          #4

          test

          R 1 Reply Last reply
          0
          • U User 4216075

            test

            R Offline
            R Offline
            RajpootRohan
            wrote on last edited by
            #5

            Member 4219169 wrote:

            test

            I am unable to understand what you want to say.

            cheers, sneha

            U 1 Reply Last reply
            0
            • R RajpootRohan

              Member 4219169 wrote:

              test

              I am unable to understand what you want to say.

              cheers, sneha

              U Offline
              U Offline
              User 4216075
              wrote on last edited by
              #6

              Have you work on the discussion forum

              R 1 Reply Last reply
              0
              • U User 4216075

                Have you work on the discussion forum

                R Offline
                R Offline
                RajpootRohan
                wrote on last edited by
                #7

                Yes but I didn't understand this thing

                cheers, sneha

                1 Reply Last reply
                0
                • R RajpootRohan

                  Hello friends, I have to display subtotal, vat,total in gridview footer. I am doing like this but nothing is displayed. <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" Font-Names="Verdana" Font-Size="Small" ForeColor="#333333" PageSize="900" Width="600px" EmptyDataText="No items in your cart!!" DataKeyNames="REF" GridLines="None" ShowFooter="True" onrowdatabound="GridView1_RowDataBound"> <FooterStyle BackColor="#1C5E55" ForeColor="#FFFFFF" Font-Bold="True" /> <RowStyle BackColor="#E3EAEB" /> <Columns> <asp:BoundField DataField="REF" HeaderText="REF" SortExpression="REF" ItemStyle-Width="60px" > <ItemStyle Width="60px"></ItemStyle> </asp:BoundField> <asp:TemplateField HeaderText="product_id" Visible="False"> <ItemTemplate> <asp:Label ID="lblProduct_Id" runat="server" Text='<%# Eval("REF") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" ItemStyle-Width="300px" > <ItemStyle Width="300px"></ItemStyle> </asp:BoundField> <asp:TemplateField HeaderText="Description" Visible="False"> <ItemTemplate> <asp:Label ID="lblDescription" runat="server" Text='<%# Eval("Description")%>' ></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="QTY"> <ItemTemplate> <asp:TextBox ID="TxtQTY" runat="server" Width="30px" Text='<%# Eval("QTY") %>' /> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" ItemStyle-Width="80px" > <ItemStyle Width="80px"></ItemStyle> </asp:BoundField> <asp:TemplateField HeaderText="Price" Visible="False"> <ItemTemp

                  N Offline
                  N Offline
                  Nishant Singh
                  wrote on last edited by
                  #8

                  Hi Sneha, I suggest you 1st give a hardCoded value Such (as your Name or mu Name :-D ) to the label and check whether the label is getting rendered .......

                  R 1 Reply Last reply
                  0
                  • R RajpootRohan

                    Hello friends, I have to display subtotal, vat,total in gridview footer. I am doing like this but nothing is displayed. <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" Font-Names="Verdana" Font-Size="Small" ForeColor="#333333" PageSize="900" Width="600px" EmptyDataText="No items in your cart!!" DataKeyNames="REF" GridLines="None" ShowFooter="True" onrowdatabound="GridView1_RowDataBound"> <FooterStyle BackColor="#1C5E55" ForeColor="#FFFFFF" Font-Bold="True" /> <RowStyle BackColor="#E3EAEB" /> <Columns> <asp:BoundField DataField="REF" HeaderText="REF" SortExpression="REF" ItemStyle-Width="60px" > <ItemStyle Width="60px"></ItemStyle> </asp:BoundField> <asp:TemplateField HeaderText="product_id" Visible="False"> <ItemTemplate> <asp:Label ID="lblProduct_Id" runat="server" Text='<%# Eval("REF") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" ItemStyle-Width="300px" > <ItemStyle Width="300px"></ItemStyle> </asp:BoundField> <asp:TemplateField HeaderText="Description" Visible="False"> <ItemTemplate> <asp:Label ID="lblDescription" runat="server" Text='<%# Eval("Description")%>' ></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="QTY"> <ItemTemplate> <asp:TextBox ID="TxtQTY" runat="server" Width="30px" Text='<%# Eval("QTY") %>' /> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" ItemStyle-Width="80px" > <ItemStyle Width="80px"></ItemStyle> </asp:BoundField> <asp:TemplateField HeaderText="Price" Visible="False"> <ItemTemp

                    N Offline
                    N Offline
                    Nishant Singh
                    wrote on last edited by
                    #9

                    <asp:TemplateField HeaderText="Price" Visible="False">

                    Why there Visible=False ????

                    R 1 Reply Last reply
                    0
                    • N Nishant Singh

                      Hi Sneha, I suggest you 1st give a hardCoded value Such (as your Name or mu Name :-D ) to the label and check whether the label is getting rendered .......

                      R Offline
                      R Offline
                      RajpootRohan
                      wrote on last edited by
                      #10

                      I already assisned "hello" to the text property of the label, but again it is not showing.

                      cheers, sneha

                      1 Reply Last reply
                      0
                      • N Nishant Singh

                        <asp:TemplateField HeaderText="Price" Visible="False">

                        Why there Visible=False ????

                        R Offline
                        R Offline
                        RajpootRohan
                        wrote on last edited by
                        #11

                        I am extremely sorry. Yes this is the reason.I am so dumb. :(( Thanks for your support.. ;)

                        cheers, sneha

                        N 1 Reply Last reply
                        0
                        • R RajpootRohan

                          I am extremely sorry. Yes this is the reason.I am so dumb. :(( Thanks for your support.. ;)

                          cheers, sneha

                          N Offline
                          N Offline
                          Nishant Singh
                          wrote on last edited by
                          #12

                          It's Ok Ma'am ..... Sometimes we overlook the most obvious of Mistakes ....... admittingly I have committed Dumber mistakes in my initial days of my career :-D So cheer up

                          R 1 Reply Last reply
                          0
                          • N Nishant Singh

                            It's Ok Ma'am ..... Sometimes we overlook the most obvious of Mistakes ....... admittingly I have committed Dumber mistakes in my initial days of my career :-D So cheer up

                            R Offline
                            R Offline
                            RajpootRohan
                            wrote on last edited by
                            #13

                            Thank you Nishant for your support. :)

                            cheers, sneha

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups