Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

ASP datagrid multiple footer template?

Posted on 2006-07-16
2
Medium Priority
?
459 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
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month20 days, 20 hours left to enroll

810 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