Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    ASP.NET


Advertisements:










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


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 Totaland I want to get the sum in Salary column


View 9 Replies (Posted: Feb 22, 2008 07:08 PM)

Sponsored Links:

Related Forum Messages For ASP.NET category:
Forms Data Controls :: How To Display Subtotal /vat / Total In Gridview Footer
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...

Posted: Nov 10, 2009 08:43 AM

View 5 Replies!   View Related
Forms Data Controls :: Gridviewhelper Cannot Subtotal 2 Column
gridviewhelper cannot subtotal 2 column

Name HD CPU

A 1 2

A 3 3

4 5

Posted: Sep 15, 2010 04:59 AM

View 1 Replies!   View Related
Forms Data Controls :: Adding Subtotal To A Group Of Records (not In Footer)?
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]....

Posted: Jun 01, 2010 08:08 AM

View 8 Replies!   View Related
Gridview Subtotal Using Jquery In C#?
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.

Posted: Jan 1 at 12:21

View 1 Replies!   View Related
C# - Calculate SubTotal In Devexpress Gridview?
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?

Posted: Mar 20 at 19:41

View 2 Replies!   View Related
Forms Data Controls :: Trying To Add Subtotal In Gridfooter With Has Grid Inside Grid?
i am trying to add subtotal in gridfooter with has grid inside grid

Posted: Jun 01, 2010 11:00 AM

View 1 Replies!   View Related
Web Forms :: Sum Up 2 Field As A New Column - SubTotal In Microsoft Visual Studio 2010 Sql Express 2008
Howto do sum 2differences fieldsas a newcolumn in Subtotal ?I know to do in Microsoft Access and that is easier.

Posted: Aug 14, 2010 04:32 PM

View 2 Replies!   View Related
SQL Reporting :: Can Subtotal In Matrix Be In A Different Group
I'm using reporting services in visual studio 2005.

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

[code]....

Posted: Apr 13, 2010 06:16 PM

View 8 Replies!   View Related
SQL Reporting :: What Is The Difference Between Matrix And Subtotal
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 ?

Posted: Sep 29, 2009 02:26 AM

View 7 Replies!   View Related
Calculating Total By Adding Subtotal Column?
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]....

Posted: Jan 28, 2009 01:17 PM

View 1 Replies!   View Related
Forms Data Controls :: (Grid View Union Gridview) - (Gridview Intersection Gridview) - Avoiding The Duplicates
I have twogridviews, say'A' and 'B'...I want to add all the rows of 'A' to 'B' while avoiding the duplicates....Foreg:

Posted: Jul 19, 2010 01:54 PM

View 10 Replies!   View Related
Forms Data Controls :: Show Child Gridview In Parent Gridview Using Nested Gridview
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.

Posted: Dec 01, 2010 12:38 PM

View 1 Replies!   View Related
Forms Data Controls :: Gridview SelectedIndex / Unable To Access The Data In The Gridview's Selected Row
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]....

Posted: Jul 31, 2010 01:54 AM

View 4 Replies!   View Related
Forms Data Controls :: Access Controls Inside Gridview When An Event Outside Gridview Fires?
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.

Posted: Jan 10, 2010 09:54 PM

View 2 Replies!   View Related
Forms Data Controls :: How To Show GridView Footer Visible, If No Data In GridView
I have a customized gridvewi.e. grvResult. There is a textbox and aInsertButton 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 thenits footer also not visible.

I have tried in two ways tomakefooter visible but it isshowingfollowing error:

Object reference not set to an instance of an object.

Tried ways:

[Code]....

[Code]....

Posted: Jan 17, 2010 08:14 AM

View 2 Replies!   View Related
Forms Data Controls :: Gridview To Excel (adding Data Outside Of The Gridview)
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]....

Posted: Jan 28, 2011 07:59 PM

View 5 Replies!   View Related
Forms Data Controls :: GridView Pass And Update Data To Another GridView?
I filtering Data toGridView 1 using LingDataSource1 Tables Main - NameAfter click select I whoud like to pass and update data to GridView 2LingDataSource 2 Tables Users - UName
I thoughtget Data from GridView1

Dim raw As GridViewRow=GridView1.SelectedRo

Posted: Nov 19, 2009 04:51 AM

View 2 Replies!   View Related
Forms Data Controls :: Transfering Data From One Gridview To Another Page Gridview?
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 andin 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]...

Posted: Apr 14, 2010 10:16 AM

View 3 Replies!   View Related
Forms Data Controls :: To Add Insert Button To A GridView And A Scroll Bar To A Given Gridview Column?
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?

Posted: Jul 09, 2010 06:35 PM

View 23 Replies!   View Related
Forms Data Controls :: Populate Dropdownlist In A Gridview By Selecting Another Dropdown In Same Gridview
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

Posted: Oct 09, 2010 07:39 AM

View 4 Replies!   View Related
Forms Data Controls :: Decrement Gridview RowCount When Deleting Record From Inner GridView?
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]....

Posted: Apr 22, 2010 02:03 PM

View 1 Replies!   View Related
Forms Data Controls :: Google Maps And GridView With Href (embedded In GridView)?
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.

Posted: Mar 09, 2010 07:56 PM

View 4 Replies!   View Related
Forms Data Controls :: Gridview Selections To Populate Another Gridview Or Control With Selection From First
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 3333Yes / No (selected Yes)
2 2222 3333 4444 Yes / No

GRIDVIEW2

ID NotesColumn
1 Texbox displays here

Posted: Feb 19, 2010 02:24 PM

View 20 Replies!   View Related
Forms Data Controls :: Display A One Row Gridview When Gridview Is Bound To Empty Dataset
If the gridview binds to empty dataset, I need to stillshow a gridview so that users can ADDmoreusing thetextfields in the bottom of thefooter template. Since the gridview is emptyit won't bind notallowing rendering of the <footer template> I guess Ishould create a empty dataset if the gridview is empty. How do I check for this and can this be done in GridviewRowEventArgs

Posted: Jan 13, 2010 11:09 PM

View 5 Replies!   View Related
Forms Data Controls :: Gridview Header And Footer Should Not Move While Scrolling Gridview
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.

Posted: Sep 13, 2010 05:09 AM

View 3 Replies!   View Related
Forms Data Controls :: How To Update Parent Gridview After Updating Child Gridview
I have aparent gridview which has a child gridviewin the itemsTemplate. Bothare 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?

Posted: Dec 14, 2010 03:03 PM

View 4 Replies!   View Related
Forms Data Controls :: Gridview FindControl / Access Textbox In Second Gridview Footertemplate
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.

Posted: Mar 17, 2011 09:34 AM

View 11 Replies!   View Related
Forms Data Controls :: Gridview Check Missing 1st One With Gridview Helper Classes
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

Posted: Feb 23, 2010 08:58 AM

View 1 Replies!   View Related
Forms Data Controls :: Gridview Sorting Failed If Multiple Gridview Are Created
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 nameon 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

Posted: Mar 10, 2011 04:04 AM

View 8 Replies!   View Related
Forms Data Controls :: Showing A Gridview Column Value In A Label Outsite The Gridview?
Ihave a gridview whereI need to show the value of the 7th column(from the 1st of gridview row) in a label on the page outside the gridview.

Posted: Dec 28, 2009 02:40 AM

View 8 Replies!   View Related
Forms Data Controls :: Selected Checkbox In Gridview Should Be Added From One To Other Gridview Using Objectdatasource
table a
a1 a
1 qw
2 asa

i have two grid views

gridview1 has check box[a1] and one value[a](in total two columns) with objectdatasource1 for datareferencing from database

another gridview2 has to select only the selected/checked value of gridview1 of checkbox1

Posted: Aug 02, 2010 09:03 AM

View 3 Replies!   View Related
Forms Data Controls :: Edit Child Gridview Inside Master Gridview?
I know there are many posts about master/child gridview. But I have not be able to find a solution to my seemingly basic problem...

I have a child gridview (user control ucChild) nested in each row of a master gridview. When I load the master gridview page, after I bind the data of the master, I go row by row & pass the key to ucChild to bind the details (child gridview).

The child gridview has a edit link - nothing fancy. After user clicks it, the master gridview page and ucChild do their routine including page load and bind data. Then it comes to ucChild's RowEditing method. I do the following:

- set the edit index of the sender (the specific child gridview)

- set sender's datasource, and bind data

But now this child gridview becomes blank...

Posted: Sep 21, 2009 11:15 PM

View 3 Replies!   View Related
Forms Data Controls :: Click On The Child Gridview And Get The Values Of The Parent Gridview?
I'm lost. I have a sub gridview in a gridview. In subGridbiview I have a button. How do Ican clicking the button and get values outside the gridview? The subgridview not present the events ...

------------------------Gridview 1------------------------------------------

| cell(0) | cell(1) | Cell(2)| Cell(3 - ITEM TEMPLATE) | -
| | | | # # # SubGridview1 ######### -
! x1 | Y1 | Z1 | # Cell(0) ! Button #-
! | | | ######################-
------------------------------------------------------------------------------
| | | | # # # SubGridview1 ######### -
! x2 | Y2 | Z2 | # Cell(0) ! Button #-
! | | | ######################-
------------------------------------------------------------------------------

how do I click on the child gridview and get the values of the parent gridview? no events in the child gridview no number indexrow on the parent gridview I'm lost.

Posted: Oct 25, 2010 12:21 PM

View 6 Replies!   View Related
Forms Data Controls :: Decrypt One Gridview Column Values Before Displaying It In The Gridview?
I have one filed that is encrypted using Rajindal algorithm and stored in MSSQL db.When I retrieve that column in gridview it's displayed in encrypted. I have the code that decrypts it but the problem is:How can I all loop throw this column values in the gridview and decrypt them all and display it in the gridview decrypted.See my code below:

[Code]....

Posted: Mar 08, 2011 06:13 PM

View 9 Replies!   View Related
Forms Data Controls :: Gridview Recalculate, Then Repopulate Gridview Without Going Back To Database?
I want to make sure I go about this in an efficient manner. I havea gridview. On the gridview, I havesome columns thatare read only values . These values go through calculations based on values in a database. The stored procedure takes information in the database, does some simply calculations (thisvalue * thatvalue / another value type of stuff) then returns a recordset as a datasource for the grid.

Other columnson the gridview havevalues the users can enter data. I want to be able to provide a recalculate button that will run calculations based on the entered values which will change the readonly valuesand then repopulate the gridview's read only values without going back to the database. This recalculate button is not the save to the database button. The save to the database button will take the values in the user entered columns and save them to the database. Then, the next time the grid is called, the page calls to the database and loads the grid.

So, what I'm looking to do is allows for recalculations on a gridview, a gridviewwith about 24 columns and about 1000 rows. My first thought is to create a class that reads the gridview and then applies the business rules, then updates the gridview some how. Or, maybe have a dataset table thats i read the value from the user inputs, then apply business rules and then bind the gridview to the dataset table. Do any of you have thoughts here, maybe have done something like this?

Posted: Mar 26, 2010 08:19 PM

View 9 Replies!   View Related
Forms Data Controls :: GridView And ObjectDataSource - Column Is Not Shown In The GridView's List ?
I'm facing a wierd problem with GridView and ObjectDataSource. I bind GridView to my business objects via ObjectDataSource. Everything was working fine until I decided to add a new field in my buisness object and wanted to add a column to GridView to show it. Somehow that column is NOT shown in the GridView's list of available columns. I have tried refreshing schema, rebinding, etc. I'm using GridView inside a user control which is used as a web part. Does that make a difference ?

Posted: Feb 09, 2011 05:38 PM

View 3 Replies!   View Related
Forms Data Controls :: Child Gridview Within A Master Gridview - Not Showing Info?
I have a master gridview with a child gridview within a template.

The master shows user information and the child will display information about this user. The info is stored in two seperate databases and there is no need for editing, etc using these gridviews so it's good that they'll only be read-only.

I'm binding the master gridview to an ObjectDataSource pointing to a DAL to populate the master gridview. The DataKeyName is the Participant ID (PartID). This works fine.

The child gridview is bound to another ObjectDataSource as well but it's being populated with the results of whatever the Participant ID (PartID) is; or that's how it should work. The DAL works fine when I test it and enter a PartID, but nothing is being displayed in the child gridview when viewed in a browser.

I've done some reading and it's suggested that this should be done via theRowDataBound event. How do I accomplish this?

Posted: Oct 15, 2009 08:24 PM

View 12 Replies!   View Related
Forms Data Controls :: GridView Export To Excel Does Not Work When Using The ConfirmButtonExtender In GridView
I am using Ajax ConfirmButtonExtender Control in GridView for Deleting the Record. I am also Exporting the GridData to Excel using Render Method. But when i click on the Export Button, i am getting below error Extender control 'confirmID' is not a registered extender control. Extender controls must be registered using RegisterExtenderControl() before calling RegisterScriptDescriptors(). Parameter name: extenderControl

Posted: Apr 01, 2011 01:19 AM

View 1 Replies!   View Related
Forms Data Controls :: How To Get The Textbox Values To Gridview And Gridview To Database
how to get the values text box values to gridview..

if i enter any text in text box those values should display in gridview.

after entering of 2 or 3 records, i will click on save then all the values of grid should insert in to DAta Base.

i dont want to get the values form Database to Gridview.

how to retrive the values form Database to Gridview.

i just want to display the values which are there in Textbox...

Posted: Jul 19, 2010 08:17 AM

View 3 Replies!   View Related
Copyright 2005-08 www.BigResource.com, All rights reserved