473,322 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

footer in gridview

Hello Everyone,

I have to display total time in the footer of my gridview so I have a
columnn a. I followed micrososft example to create the footer and display the
total time and it is not displaying anything in the footer of the gridview.
Below is my code

colA

9:05:45 AM
9:13:48 AM
9:14:10 AM
9:23:52 AM
9:23:52 AM
9:23:52 AM
9:23:52 AM
9:24:51 AM
9:24:51 AM
9:25:03 AM
9:25:10 AM
-------------
TotalTime:
protected void dgAgentActivity_RowDataBound(object sender,
GridViewRowEventArgs e)
{
TableCell cell = e.Row.Cells[18];
DateTime itemTotal1 = DateTime.Parse(itemTotal);
DateTime dt2 = new DateTime();
TimeSpan dt1 = new System.TimeSpan(
Int32.Parse(itemTotal1.Hour.ToString()),
Int32.Parse(itemTotal1.Minute.ToString()),
Int32.Parse(itemTotal1.Second.ToString()));
DateTime ts = dt2.Add(dt1);
DateTime orderTotal = ts;

protected void dgAgentActivity_RowCreated(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Footer)
{

// Get the OrderTotalLabel Label control in the footer row.
Label total = (Label)e.Row.FindControl("TotalTime");

// Display the grand total of the order formatted as currency.
if (total != null)
{
total.Text = orderTotal.ToString("c");
}

}
}

global variable
private DateTime orderTotal= new DateTime();

amd aspx page template column lloks like this
<asp:GridView ID="dgAgentActivity" runat="server"
AutoGenerateColumns="false" CellPadding="0" CellSpacing="1"
BackColor="AliceBlue" OnRowDataBound="dgAgentActivity_RowDataBound"
OnRowCreated="dgAgentActivity_RowCreated" ShowFooter="true">
<Columns>
<asp:templatefield headertext="SwitchTime"
itemstyle-horizontalalign="Right"
footerstyle-horizontalalign="Right"
footerstyle-backcolor="Blue"
footerstyle-forecolor="White">
<itemtemplate>
<%#Eval("SwitchTime", "{0:c}")%>
</itemtemplate>
<footertemplate>
<asp:label id="TotalTime"
runat="server"/>
</footertemplate>
</asp:templatefield>
</Columns>
</asp:GridView>

above is the 18th column. I am not showing all other columns.

Any help will be appreciated.
Apr 24 '07 #1
0 7764

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: tfsmag | last post by:
I know how to do summary footers in a gridview... but when i try it in a paged gridview it puts a footer on every page of just the items on that page. Any suggestions on how to get it to work so...
1
by: Stu Lock | last post by:
Hi, I've spent the last hour trawling google for this - but all I find are people asking the same question! I have a gridview which is being databound to an empty datasource. I can display...
1
by: Andrew Robinson | last post by:
I am using the following code to preload a few controls in the FooterRow within a GridView control: protected void Page_Load(object sender, EventArgs e) {...
0
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I have a gridview. I calculated some values in the gridview for the footer of the gridview so basically I am adding all the values that are displayed in the gridview for each...
0
by: gnewsgroup | last post by:
Well, I am trying to use the footer row of a GridView for insertion purpose. There are some articles about this, for example, the gridviewguy.com has an example, which always displays the footer...
2
by: Tim Royal | last post by:
I'm using a GridView inside a Wizard Control with a textbox and two listboxes in the footer. I populate these listboxes from the database if the page isn't on postback (and the textbox is left...
1
by: Michael | last post by:
I reviewed a couple of tutorials that show how to display totals in the footer of a gridview. My footer shows up blank. Can someone help me. The code is as follows: <%@ Page Language="VB" %>...
0
by: Mel | last post by:
How do I set the footer text for a GridView that has AllowPaging set to True? I can only get the footer to appear on the first page but I really want the same text to appear in the footer of all...
0
by: Bogdan | last post by:
Hi, I need to modify gridview footer so it consists only of a single column that spans all data columns in a gridview. I first tried DataBound() event (as per suggestion found on the Net) but...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.