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:
<%#DataBinder.Eval(Container,"DataItem.SumColumn") %> inside the footer
template, i get nothing...
Any help? 5 8696
Hi,
Data could be binded in the footer template. This is possible.
Hope so,
<%# DataBinder.Eval(Container,"DataItem.SumColumn") %> this is wrong. The
right syntax is
<%# DataBinder.Eval(Container.DataItem,"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("SumColumn",Double,"Sum(ItemTotal)") ds.tables(0).columns.Add(SumColumn)
if i do:
<%#DataBinder.Eval(Container,"DataItem.SumColumn") %> inside the footer template, i get nothing...
Any help?
The Syntax you suggested above fails to compile:
'DataItem' is not a member of 'System.Web.UI.Control'.
Tascien
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("SumColumn",Double,"Sum(ItemTotal)") ds.tables(0).columns.Add(SumColumn)
if i do:
<%#DataBinder.Eval(Container,"DataItem.SumColumn") %> inside the footer template, i get nothing...
Any help?
Ahhhhhhhhhh... funny but this one seem to be working...:
<%#Ctype(Container.Parent,Object).DataSource(0)("I D") %>
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.ID" ) %>
</ItemTemplate>
<FooterTemplate>
<%# Ctype(Container.Parent,Object).DataSource(0)("Sum" ) %>
</FooterTemplate>
</asp:Repeater>
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(Container.Parent,Object).DataSource(0)("I D") %>
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.ID" ) %> </ItemTemplate>
<FooterTemplate> <%# Ctype(Container.Parent,Object).DataSource(0)("Sum" ) %> </FooterTemplate>
</asp:Repeater>
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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.
|
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...
|
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...
|
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
|
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">...
|
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 =...
|
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...
|
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...
|
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....
|
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...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
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...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
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...
|
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....
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |