473,597 Members | 2,726 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataItem.Eval inside <FooterTemplate >

I am just wondering... can footertemplate hold data?

b/c i want to show the sum of my Invoice in footer template. How can i
do that? I could add the sum to the dataset like this:

SumColumn = new DataColumn("Sum Column",Double, "Sum(ItemTotal) ")
ds.tables(0).co lumns.Add(SumCo lumn)

if i do:

<%#DataBinder.E val(Container," DataItem.SumCol umn")%> inside the footer
template, i get nothing...

Any help?

Jul 22 '05 #1
5 8743
Hi,

Data could be binded in the footer template. This is possible.

Hope so,

<%# DataBinder.Eval (Container,"Dat aItem.SumColumn ") %> this is wrong. The
right syntax is
<%# DataBinder.Eval (Container.Data Item,"SumColumn ") %>

"tascien" wrote:
I am just wondering... can footertemplate hold data?

b/c i want to show the sum of my Invoice in footer template. How can i
do that? I could add the sum to the dataset like this:

SumColumn = new DataColumn("Sum Column",Double, "Sum(ItemTotal) ")
ds.tables(0).co lumns.Add(SumCo lumn)

if i do:

<%#DataBinder.E val(Container," DataItem.SumCol umn")%> inside the footer
template, i get nothing...

Any help?

Jul 22 '05 #2
The Syntax you suggested above fails to compile:

'DataItem' is not a member of 'System.Web.UI. Control'.

Tascien

Jul 22 '05 #3

Hi there,

You need to handle the DataGrid's ItemDataBound event. This event is raised
every time an item is bound to the data source. You can then have a variable
that adds up all the values in this event and display it in the footer by
handling the ItemCreated event. Check the documentation, the arguments of
these events include the item, so you can add a label control to display the
total at the footer.

Good luck!

--
Juan Romero
-----------------------------------------
The successful person has the habit of doing the things failures don't like
to do.
E.M. Gray
"tascien" wrote:
I am just wondering... can footertemplate hold data?

b/c i want to show the sum of my Invoice in footer template. How can i
do that? I could add the sum to the dataset like this:

SumColumn = new DataColumn("Sum Column",Double, "Sum(ItemTotal) ")
ds.tables(0).co lumns.Add(SumCo lumn)

if i do:

<%#DataBinder.E val(Container," DataItem.SumCol umn")%> inside the footer
template, i get nothing...

Any help?

Jul 22 '05 #4
Ahhhhhhhhhh... funny but this one seem to be working...:

<%#Ctype(Contai ner.Parent,Obje ct).DataSource( 0)("ID") %>

funny... see below (but it will crash if the invoice contains no
items... ) :

<asp:Repeater id=Repeater2 DataSource='<%# GetSales() %>'
runat="server">

<ItemTemplate >
<%# DataBinder.Eval ( Container, "DataItem.I D" ) %>
</ItemTemplate>

<FooterTemplate >
<%# Ctype(Container .Parent,Object) .DataSource(0)( "Sum") %>
</FooterTemplate>

</asp:Repeater>

Jul 22 '05 #5

As a general rule, I suggest you avoid doing runtime data binding. It is
much slower and not a good practice. It is preferable to do it in the
assembly so the code is compiled, fast, and easy to understand.
--
Juan Romero
-----------------------------------------
The successful person has the habit of doing the things failures don't like
to do.
E.M. Gray
"tascien" wrote:
Ahhhhhhhhhh... funny but this one seem to be working...:

<%#Ctype(Contai ner.Parent,Obje ct).DataSource( 0)("ID") %>

funny... see below (but it will crash if the invoice contains no
items... ) :

<asp:Repeater id=Repeater2 DataSource='<%# GetSales() %>'
runat="server">

<ItemTemplate >
<%# DataBinder.Eval ( Container, "DataItem.I D" ) %>
</ItemTemplate>

<FooterTemplate >
<%# Ctype(Container .Parent,Object) .DataSource(0)( "Sum") %>
</FooterTemplate>

</asp:Repeater>

Jul 22 '05 #6

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

Similar topics

2
5229
by: Leo Duran | last post by:
Hi, I am working on an app right now that makes extensive use of the DataList control. I chose the DataList because I need to do multi row formatting. I am using it like so.
1
1233
by: Jorge Loaiza Arango | last post by:
Hi group, When I have TextBox1 in the <ItemTemplate> of Datagrid1, I can to access the propierties using: dim myTBox as TextBox = Datagrid1.Item(row).FindControl("TextBox1") but, if it is in the <FooterTemplate>... ¿How do I can the properties?
1
7627
by: CJM | last post by:
I've copied (& modified) some code from MSDN which uses a Repeater control, but I'm getting an error: Unexpected end of file looking for </HeaderTemplate> As far as I can see I've not made an dramatic changes, and if the MSDN code would work, I would also expect mine to work. As far as the </HeaderTemplate> tag is concerned, I removed it and replaced it - but it did not appear in the Intellisense list.
2
3886
by: Olivier Verdin | last post by:
Hi, It seems that it is not possible to use <il> tag inside an asp.net repeater. Is there any way to overcome this difficulty? Thanks, Olivier
3
2749
by: webserverpete | last post by:
I would like to have multiple <td> in a repeater control. The below code does not work: <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1" DataMember="DefaultView"> <HeaderTemplate> <table> </HeaderTemplate> <tr> <ItemTemplate> <td>
5
273
by: tascien | last post by:
I am just wondering... can footertemplate hold data? b/c i want to show the sum of my Invoice in footer template. How can i do that? I could add the sum to the dataset like this: SumColumn = new DataColumn("SumColumn",Double,"Sum(ItemTotal)") ds.tables(0).columns.Add(SumColumn) if i do:
0
1723
by: deathtospam | last post by:
A few weeks ago, I created a Classic ASP page that connects to a machine with SQL Server installed on it, prompts the user to select a database on that server, then lists all of user-created stored procedures in that database. The user can select any of those stored procedures by clicking on checkboxes; after submitting their selections, a script to delete and then re-create each stored procedure will be generated. Now I'm trying to do...
1
5068
by: David Lozzi | last post by:
Howdy, I have a datalist which is displaying a list of categories and their associated sub categories in secondary datalists. Works great in a single column. Unfortunaly when i switch it to repeatcolumn = 2 (or three or anything over 1) , the data is displayed quite erratically, for example category 1 category 3 sub 1 sub 1 sub 2
0
2034
by: Jeff | last post by:
hi asp.net 2.0 I have a GridView which in it's FooterTemplate contain textboxes for adding new rows to the GridView. I thought that was cool, until I tested the GridView without any data. Then the FooterTempalte isn't displayed and I have way of adding rows to the GridView :(
0
7979
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8281
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
8381
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
8262
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...
1
5847
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5437
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();...
1
2409
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1497
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1245
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.