473,769 Members | 4,052 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(o bject sender,
GridViewRowEven tArgs e)
{
TableCell cell = e.Row.Cells[18];
DateTime itemTotal1 = DateTime.Parse( itemTotal);
DateTime dt2 = new DateTime();
TimeSpan dt1 = new System.TimeSpan (
Int32.Parse(ite mTotal1.Hour.To String()),
Int32.Parse(ite mTotal1.Minute. ToString()),
Int32.Parse(ite mTotal1.Second. ToString()));
DateTime ts = dt2.Add(dt1);
DateTime orderTotal = ts;

protected void dgAgentActivity _RowCreated(obj ect sender,
GridViewRowEven tArgs e)
{
if (e.Row.RowType == DataControlRowT ype.Footer)
{

// Get the OrderTotalLabel Label control in the footer row.
Label total = (Label)e.Row.Fi ndControl("Tota lTime");

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

}
}

global variable
private DateTime orderTotal= new DateTime();

amd aspx page template column lloks like this
<asp:GridView ID="dgAgentActi vity" runat="server"
AutoGenerateCol umns="false" CellPadding="0" CellSpacing="1"
BackColor="Alic eBlue" OnRowDataBound= "dgAgentActivit y_RowDataBound"
OnRowCreated="d gAgentActivity_ RowCreated" ShowFooter="tru e">
<Columns>
<asp:templatefi eld headertext="Swi tchTime"
itemstyle-horizontalalign ="Right"
footerstyle-horizontalalign ="Right"
footerstyle-backcolor="Blue "
footerstyle-forecolor="Whit e">
<itemtemplate >
<%#Eval("Switch Time", "{0:c}")%>
</itemtemplate>
<footertemplate >
<asp:label id="TotalTime"
runat="server"/>
</footertemplate>
</asp:templatefie ld>
</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 7860

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

Similar topics

0
1449
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 that it only posts on the last page of the gridview with the totals for the entire dataset? here is how i'm getting the footer summary now Protected Sub TotIncurGrid_RowDataBound(ByVal sender As Object, ByVal e As...
1
4976
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 the 'EmptyDataText' no problem, but the header and footer do not display. The header I can live without - but the footer contains the 'Add new item' form elements, so needs to be visible when the grid is empty.
1
7971
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) { ((TextBox)GriwViewRates.FooterRow.FindControl("TextBoxRateInsert")).Text = "60"; } The successfully loads the Footer / TextBox on page load but fails to load the Footer / TextBox when the GridView is Paged. The line still executes
0
1798
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 column and displaying the total in the footer of the gridview. Now I export the gridview to excel spreadsheet with the code below. Everything is exported well except the footer value become zero in the excel spreadsheet. Can anyone tell me how can i...
0
2708
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 row. I would like to display the footer row, only when a LinkButton "Add New" is clicked. And after the new record is saved to the database, let the footer row disappear. In the LinkButton's click event handler, I simply say:
2
3507
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 blank initially). All of these controls have viewstate enabled. When the user fills out the textfield and clicks ADD, I do a check for validation of the data. If the user does not select a valid listbox entry, I abort the rest of the add, and make...
1
1664
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" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server">
0
1483
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 pages, how do I do that? Example Code: Protected Sub Get_Data() adsQuotes.SelectCommand = "SELECT FROM WHERE ( 0)" 'access data source adsQuotes.DataBind()
0
1378
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 that did not always work. That is, the initial gridview display was fine but after selecting a row the footer's column count was 'restored' to the gridview's column count. I then tried RowCreated event and it seems to work. Is this a good place...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10215
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10049
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6674
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5307
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3564
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.