[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

ASP datagrid multiple footer template?

Posted on 2006-07-16
2
Medium Priority
?
453 Views
Last Modified: 2006-11-18
I have a datagrid that needs multiple footer lables for a shopping cart (Sub Total, TAX, Grand Total).

So far I can successfully create a single total like so, but...............

[Code Behind C#]
  public void DataGrid1_ItemDataBound(object sender, DataGridItemEventArgs e)
  {
        if (e.Item.ItemType == ListItemType.Footer)
        {
            e.Item.Cells[2].Text = "Sub Total:";
            e.Item.Cells[3].Text = string.Format("{0:c}", total);
        }

[ASPX]
  <FooterTemplate>
<table>
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text='123'></asp:Label>
</td>
<tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text='456'></asp:Label>
</td>
<tr>
</table>
</FooterTemplate>
0
Comment
Question by:kvnsdr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
Solar_Flare earned 750 total points
ID: 17118365
is the problem that you cant add up the totals or cant add more labels/rows to the footer?
0
 
LVL 1

Author Comment

by:kvnsdr
ID: 17118516
I think the most confusing part of programming is that there are several ways to do the same thing.

I attempt to find the most simple and effective like this one I found at EE.

http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/ASP_DOT_NET/Q_21457879.html?query=Multiple+footers&topics=865

It does do the trick, however I'm now having trouble formating my results correctly so they will show in the footer.

Total: $4.00    // Correct
Tax:   $0.00    // Should be .24
Total: $0.00    // Should be $4.24


decimal Tax = Convert.ToDecimal(.06);
decimal TaxedAmt = total * (1 + dInTax);

       
e.Item.Cells[2].Text = "Sub:" + "<br>" +
                                 "Tax" + "<br>" +
                                 "Total";

e.Item.Cells[3].Text = string.Format("{0:c}", total) + "<br>" +
                                 string.Format("{0:c}", Tax)  + "<br>" +
                                 string.Format("{0:c}", TaxedAmt);
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question