Forms Data Controls :: How To Add Subtotal Row In Gridview

Feb 22, 2008

I have a gridview that I programmatically bind to a dataset.

I use compute to get the totals and then display it in the gridview eg GridView1.Columns(4).FooterText = "$ " & FormatNumber(MoneybagTot, 0)

My Question is: How do I add a subtotal row after each group and how do I get the totals in each group

[code]....

Now I want row inserted after end of Africa, that says Total and I want to get the sum in Salary column

View 9 Replies


ADVERTISEMENT

Forms Data Controls :: How To Display Subtotal /vat / Total In Gridview Footer

Nov 10, 2009

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">
<ItemTemplate>
<asp:Label ID="lblPrice" runat="server" Text='<%# Eval("Price")%>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Cost" HeaderText="Cost" SortExpression="Cost"
ItemStyle-Width="80px" >
<ItemStyle Width="80px"></ItemStyle>
</asp:BoundField>
<asp:TemplateField HeaderText="Cost" Visible="False">
<ItemTemplate>
<asp:Label ID="lblCost" runat="server" Text='<%# Eval("Cost")%>' ></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:Label ID="lblSubTotal" runat="server" ForeColor="#ffffff" />
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Select">
<ItemTemplate>
<asp:CheckBox ID="chkSelection" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#7C6F57" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Label lblCost = (Label)e.Row.FindControl("lblCost");
float price = float.Parse(lblCost.Text);
tprice += price;
}
if (e.Row.RowType == DataControlRowType.Footer)
{
Label lblSubTotal = (Label)e.Row.FindControl("lblSubTotal");
lblSubTotal.Text = tprice.ToString();
}
}

assist where I am doing wrong...

View 5 Replies View Related

Forms Data Controls :: Gridviewhelper Cannot Subtotal 2 Column

Sep 15, 2010

gridviewhelper cannot subtotal 2 column

Name HD CPU

A 1 2

A 3 3

4 5

View 1 Replies View Related

Forms Data Controls :: Adding Subtotal To A Group Of Records (not In Footer)?

Jun 1, 2010

I have trawled through the entire web and found that most examples show how to add a total to the footer.

However, I am not after this and I want to add a total for the column 'Office sqm' for each group of addresses ONLY when the value of the 'Summed' is equal to Yes.

[code]....

View 8 Replies View Related

Gridview Subtotal Using Jquery In C#?

Jan 1, 2011

i am having a problem in counting subtotal in a gridview in asp.net

the gridview contains details like

[code].....

i need to calculate the sum of the user entry for each item and display into the resultant lable.

when ever the user entry is made the value in the result lable should be updated,i am binding a javascript function to the userentry textbox in rowdatabound event in code behind.in the javascript i am able to roll over all the rows of table using jquery, and calculate the value. here is the catch, the labletodispresult should be for that item group only, i.e. i need to get the sum of userentry for A -1,A-2, A-3 rows and seperately for B-1,B-2,B-3 rows, the i am using a class for the userentry textbox, and using this

[code]...

this gives me all the textboxes sum value, but i need the values based on the Item group.

View 1 Replies View Related

C# - Calculate SubTotal In Devexpress Gridview?

Mar 20, 2011

I have a simple Devexpress Gridview.

Here code;

[code]...

Is there any way calculate sub total of Unit Price column in Devexpress?

For this example; I just want total of Unit Price column (18 + 19 + 4.5 + 14 + 18 + 263.5 + 18 + 46 + 14 + 14 + 15 = 430) in the bottom..

How can i do that?

View 2 Replies View Related

Forms Data Controls :: Trying To Add Subtotal In Gridfooter With Has Grid Inside Grid?

Jun 1, 2010

i am trying to add subtotal in gridfooter with has grid inside grid

View 1 Replies View Related

Web Forms :: Sum Up 2 Field As A New Column - SubTotal In Microsoft Visual Studio 2010 Sql Express 2008

Aug 14, 2010

How to do sum 2 differences fields as a new column in Subtotal ? I know to do in Microsoft Access and that is easier.

View 2 Replies View Related

SQL Reporting :: Can Subtotal In Matrix Be In A Different Group

Apr 13, 2010

I'm using reporting services in visual studio 2005.

I'm using a matrix and it looks like this.

[code]....

View 8 Replies View Related

SQL Reporting :: What Is The Difference Between Matrix And Subtotal

Sep 29, 2009

I have a matrix and i want in the subtotal column, instead of sum, i want to get the difference. Is there anyway to do this ?

View 7 Replies View Related

Calculating Total By Adding Subtotal Column?

Jan 28, 2009

I have a Datatable binding into a session and a GridView to display the rows in the datatable. now I am having some difficults with calculating the Total by adding all subtotal column cells and dispaying the total on label.

this is the fuction I am trying to work with.

[code]....

View 1 Replies View Related

Forms Data Controls :: (Grid View Union Gridview) - (Gridview Intersection Gridview) - Avoiding The Duplicates

Jul 19, 2010

I have two gridviews, say 'A' and 'B'...I want to add all the rows of 'A' to 'B' while avoiding the duplicates....For eg:

View 10 Replies View Related

Forms Data Controls :: Show Child Gridview In Parent Gridview Using Nested Gridview

Dec 1, 2010

In nested gridview, i am finding some problem, i want to show child Grid headers in Parent Gridview. Can anyone tell me that how it is possible? Its very urgent. Waiting for quick response.

View 1 Replies View Related

Forms Data Controls :: Gridview SelectedIndex / Unable To Access The Data In The Gridview's Selected Row

Jul 31, 2010

I am unable to access the data in the gridview's selected row. I have done this lots of times but must be forgetting something.

Here is my gridview:

[Code]....
[Code]....
[Code]....

View 4 Replies View Related

Forms Data Controls :: Access Controls Inside Gridview When An Event Outside Gridview Fires?

Jan 10, 2010

I have a dropdownlist outside the gridview control. My griview control also have dropdownlist in the first column. I want to populate the dropdownlist inside the gridview control for all rows when the selected item is changed in the outside dropdownlist.

View 2 Replies View Related

Forms Data Controls :: How To Show GridView Footer Visible, If No Data In GridView

Jan 17, 2010

I have a customized gridvew i.e. grvResult. There is a textbox and a InsertButton in the footer.

If there is a data populated into gridview it is showing GridView footer and inserting data but if there is no data in gridview then its footer also not visible.

I have tried in two ways to make footer visible but it is showing following error:

Object reference not set to an instance of an object.

Tried ways:

[Code]....

[Code]....

View 2 Replies View Related

Forms Data Controls :: Gridview To Excel (adding Data Outside Of The Gridview)

Jan 28, 2011

I was wondering if it is possible to add additional data to Excel document created from gridview. What I want to do is to manually add data to certain rows and columns (date, couple of titles, etc), but I'm not sure how to do it.

Currently I'm using the following code:

[Code]....

View 5 Replies View Related

Forms Data Controls :: GridView Pass And Update Data To Another GridView?

Nov 19, 2009

I filtering Data to GridView 1 using LingDataSource 1 Tables Main - Name After click select I whoud like to pass and update data to GridView 2 LingDataSource 2 Tables Users - UName
I thought get Data from GridView1

Dim raw As GridViewRow=GridView1.SelectedRo

View 2 Replies View Related

Forms Data Controls :: Transfering Data From One Gridview To Another Page Gridview?

Apr 14, 2010

iam using asp.net with c#, my grid contains 1st column is check box ,and paging is true ,iam displaying data from view that does not contain primary key, so based on this when user selects the no of checkboxes in 1st page and in another page some records then i want to transfer to another page gridview but it is not displaying. can you correct my code where iam going wrong

string constr = "Data Source=MAINSERVER;Initial Catalog=Inventory;User ID=sa;Password=nsg";
protected void Page_Load(object sender, EventArgs e)
{

[code]...

View 3 Replies View Related

Forms Data Controls :: To Add Insert Button To A GridView And A Scroll Bar To A Given Gridview Column?

Jul 9, 2010

how to implement Insert feature to a grid view?I need to use fields with scroll bar inside of a grid view. Is that possible through the template field?

View 23 Replies View Related

Forms Data Controls :: Populate Dropdownlist In A Gridview By Selecting Another Dropdown In Same Gridview

Oct 9, 2010

How to populate dropdownlist in a gridview by selecting another dropdown in same gridview

i tried the code in driiopdownlist selectedchanged

dropdownlist d=(dropdownlist)gridview.findcontrol("dropdownlist1") but it gives null

View 4 Replies View Related

Forms Data Controls :: Decrement Gridview RowCount When Deleting Record From Inner GridView?

Apr 22, 2010

Using vb.net/asp.net 2005.I have an inner gridview.The outer gridview is "Authors" and in the inner gridview (GridView1 below) I have to set it up so that the user cannot delete the last book from the inner grid, if they try to delete the last book from that inner grid then I want to show the exception message below.

So I am checking the GridViewRows1.Rows.Count which works great when I have one record (one book) to start with. The problem is when I have 2 books (for example). I am writing out the test statement below and the RowCount is always 2 each time, never decremented, even after I rebind.Editing this now: i realize that my initial logic is faulty because when I rebind my inner gridview I am not specifying which inner gridview so the result is that only the last inner gridview is being re-bound, so I think that I need to get the selected inner gridview and then refresh that...

[Code]....

View 1 Replies View Related

Forms Data Controls :: Google Maps And GridView With Href (embedded In GridView)?

Mar 9, 2010

I had a problem with my site in the past couple days and have almost recovered, but now I'm stuck on some code that has an Auto-Complete feature, which allows a user to type a name of a pub into a TetxBox, and based on the returned names, the user can click one and see that name in the GridView (just below the TextBox). The GridView was set up so that there was an href that the user could click on and that would open a window and the user would see the pub in Google Maps. The code below works just fine for the Auto-Complete and the GridView.

[Code]....

Here is the end of the working code. Somehow I need to use the code below to make
the GridView have a href to allow a user to click and see the pub in Google
Maps:

[Code]....

The code above worked fine before, but I'm not sure how it was incorporated into the GridView, and since I had a problem with my site a few days ago, I haven't been able to figure out this part.I'd sincerely appreciate any help in getting this up and running again.

View 4 Replies View Related

Forms Data Controls :: Gridview Selections To Populate Another Gridview Or Control With Selection From First

Feb 19, 2010

I currently have a gridview that has 1 column with radiobuttons. I then have a update button to update all the selected records. But what i want to do is add a step before the update. I want to add a multi-line textbox for each radiobutton selected to allow them to add notes/comments for each record before the update occurs.

Because the textbox will be large to allow them to enter the comments, i wanted to list them out seperately per record selected. Maybe a gridview is not what i need for the 2nd part, but thats the scenario and looking for suggestions on what / how to do it.

Example:

GRIDVIEW1

ID column1 column2 column3 radiocolumn
1 1111 2222 3333 Yes / No (selected Yes)
2 2222 3333 4444 Yes / No

GRIDVIEW2

ID NotesColumn
1 Texbox displays here

View 20 Replies View Related

Forms Data Controls :: Display A One Row Gridview When Gridview Is Bound To Empty Dataset

Jan 13, 2010

If the gridview binds to empty dataset, I need to still show a gridview so that users can ADD more using the textfields in the bottom of the footer template. Since the gridview is empty it won't bind not allowing rendering of the <footer template> I guess I should create a empty dataset if the gridview is empty. How do I check for this and can this be done in GridviewRowEventArgs

View 5 Replies View Related

Forms Data Controls :: Gridview Header And Footer Should Not Move While Scrolling Gridview

Sep 13, 2010

i am using Grid view. when ever bulk data is there in Gridview, Header and footer must not be move..

how can i do that.

View 3 Replies View Related

Forms Data Controls :: How To Update Parent Gridview After Updating Child Gridview

Dec 14, 2010

I have a parent gridview which has a child gridview in the itemsTemplate. Both are binded to different SqlDataSources. I can successfully update and delete rows in the child gridview. After updating in the child gridview, some related data in the parent gridview are not updated automatically. So i have placed ParentGridview.Databind() in the rowupdated event of child gridview. But it doesnt look working.

How can i accomplish this?

View 4 Replies View Related

Forms Data Controls :: Gridview FindControl / Access Textbox In Second Gridview Footertemplate

Mar 17, 2011

I have nested 2gridview. I want to access textbox in second gridview footertemplate. How can I do this.My code is

[Code]....

Code Behind

[Code]....

Iwrite this code but I get

Object reference not set to an instance of an object.

View 11 Replies View Related

Forms Data Controls :: Gridview Check Missing 1st One With Gridview Helper Classes

Feb 23, 2010

im reading checkbox value which is checked on my gridview but as per my code is missing the 1st one which on top but i select from the middle then it is working fine here is link for gridviewhelper classes [URL] and im calling this code from gridviewhelper classes on page load event

Dim helper As New GridViewHelper(Me.GridView2)
helper.RegisterGroup("heading", True, True)
AddHandler helper.GroupHeader, AddressOf helper_GroupHeader

and here is my code

Dim sc As New StringCollection()
Dim id As String = String.Empty
For i As Integer = 0 To GridView2.Rows.Count - 1
'loop the GridView Rows
Dim cb As CheckBox = DirectCast(GridView2.Rows(i).Cells(2).FindControl("CheckBox2"), CheckBox)
'find the CheckBox
If cb IsNot Nothing Then
If cb.Checked Then
id = GridView2.Rows(i).Cells(1).Text
sc.Add(id)
MsgBox(id)
End If
End If
Next

View 1 Replies View Related

Forms Data Controls :: Gridview Sorting Failed If Multiple Gridview Are Created

Mar 10, 2011

I got a web page, it has a tabcontainer, within each tab, there will be a gridview, all the tabs and gridview are created at run-time, i have only one code, that I will loop through to create all those tabs and gridview. When I apply the sorting, and I click on the column name on any grid, it returned an error saying index was out of bound. BUT, when there is only ONE grid view created, it is working fine, I suspect it mixed up all the grid view's id and so on. But I have assigned different ID to gridview

View 8 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved