total and subtotal in gridview footer
-
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
-
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
Hi Sneha you need to basically debug the GridView1_RowDataBound function. In my opinion
Label lblSubTotal = (Label)e.Row.Cells[4].FindControl("lblSubTotal");
-
Hi Sneha you need to basically debug the GridView1_RowDataBound function. In my opinion
Label lblSubTotal = (Label)e.Row.Cells[4].FindControl("lblSubTotal");
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
-
Hi Sneha you need to basically debug the GridView1_RowDataBound function. In my opinion
Label lblSubTotal = (Label)e.Row.Cells[4].FindControl("lblSubTotal");
test
-
test
Member 4219169 wrote:
test
I am unable to understand what you want to say.
cheers, sneha
-
Member 4219169 wrote:
test
I am unable to understand what you want to say.
cheers, sneha
Have you work on the discussion forum
-
Have you work on the discussion forum
Yes but I didn't understand this thing
cheers, sneha
-
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
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 .......
-
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
<asp:TemplateField HeaderText="Price" Visible="False">
Why there Visible=False ????
-
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 .......
I already assisned "hello" to the text property of the label, but again it is not showing.
cheers, sneha
-
<asp:TemplateField HeaderText="Price" Visible="False">
Why there Visible=False ????
I am extremely sorry. Yes this is the reason.I am so dumb. :(( Thanks for your support.. ;)
cheers, sneha
-
I am extremely sorry. Yes this is the reason.I am so dumb. :(( Thanks for your support.. ;)
cheers, sneha
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
-
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
Thank you Nishant for your support. :)
cheers, sneha