aspx Tutorial

.NET Articles,jQuery demo, asp.net with jQuery, online tutorial,Jquery, SilverLight, Javascript, asp.net,JSON, MVC,.NET Articles,demo, Web Services, .NET articles, Sharepoint 2010, visual studio 2010,Aamir Hasan,IT
Advertise Here

Advertize

wwwSW
Posted by Aamir Hasan   on Saturday, July 9, 2011 Total Views:  

In my previous example, i have told you how to add confirm pop up and Repeater server control in ASP.NET using jQuery. In this example, I will elaborate my last example and shows you how to display total price in footer of Repeater control using jQuery.


Here’s an example.


Design code

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title>Display total amount in Repeater footer in asp.net using jquery</title>

    <style>

        #table1

        {

            width: 500px;

            font-size: .80em;

            font-family: "Helvetica Neue" , "Lucida Grande" , "Segoe UI" , Arial, Helvetica, Verdana, sans-serif;

            margin: 0px;

            padding: 0px;

            color: #666;

        }

        #table1 th

        {

            border-bottom: 1px solid #eee;

            border-top: 1px solid #eee;

            height: 29px;

            text-align: left;

            padding-left: 10px;

            background-color: #fafafa;

        }

        #table1 td

        {

            border-bottom: 1px solid #eee;

            padding-left: 10px;

        }

    </style>

    <script src="http://code.jquery.com/jquery-1.6.2.min.js" type="text/javascript"></script>

    <script type="text/javascript">

        $(document).ready(function () {

            var Amount = 0;

            $("#table1 tr").each(function (index) {

                var value = $(this).find("td:nth-child(3)").html();

                if (value != null && value != "" && !isNaN(value))

                    Amount = Amount + parseFloat($(this).find("td:nth-child(3)").html());

            });

            $("#total").text("Total Price: " + Amount.toFixed(2));

        });

    </script>

</head>

<body>

    <form id="form1" runat="server">

    <div>

        <asp:Repeater ID="Repeater1" runat="server">

            <HeaderTemplate>

                <table id="table1">

                    <thead>

                        <tr>

                            <th>

                                Title

                            </th>

                            <th>

                                Author

                            </th>

                            <th>

                                Price

                            </th>

                        </tr>

                    </thead>

                    <tbody>

            </HeaderTemplate>

            <ItemTemplate>

                <tr>

                    <td>

                        <%# ((Book)Container.DataItem).Title %>

                    </td>

                    <td>

                        <%# ((Book)Container.DataItem).Author %>

                    </td>

                    <td>

                        <%# ((Book)Container.DataItem).Price %>

                    </td>

                </tr>

            </ItemTemplate>

            <FooterTemplate>

                </tbody>

                <tfoot>

                    <tr>

                        <th colspan="2">

                            &nbsp

                        </th>

                        <th>

                            <div id="total">

                            </div>

                        </th>

                    </tr>

                </tfoot>

                </table>

            </FooterTemplate>

        </asp:Repeater>

    </div>

    </form>

</body>

</html>

 

Code behind

protected void Page_Load(object sender, EventArgs e)

    {

        Repeater1.DataSource = Display();

        Repeater1.DataBind();

    }

 

    public List<Book> Display()

    {

        List<Book> Obj = new List<Book>()

        {

            new Book{ Title="ASP.NET C#", Author="Aamir Hasan", Price= 101.1F},

            new Book{ Title="ASP.NET Control", Author="Aamir Hasan", Price= 120.1F},

            new Book{ Title="ASP.NET Development", Author="Aamir Hasan", Price= 140.1F},

            new Book{ Title="ASP.NET Desing Pattern", Author="Aamir Hasan", Price= 50.1F},

            new Book{ Title="Sharepoint 2010 Administration", Author="Aamir Hasan", Price= 70.1F},

            new Book{ Title="Sharepoint 2010 Development", Author="Aamir Hasan", Price= 80.1F},

            new Book{ Title="jQuery", Author="Aamir Hasan", Price= 90.1F},

            new Book{ Title="HTML 5", Author="Aamir Hasan", Price= 20.1F},

            new Book{ Title="Javascript", Author="Aamir Hasan", Price= 40.1F},

            new Book{ Title="ASP.NET C#", Author="Aamir Hasan", Price= 70.1F}

        };

 

        return Obj;

    }

 

    public class Book

    {

        public string Title { get; set; }

        public string Author { get; set; }

        public float Price { get; set; }

    }

 

Output

Download

Repeater-jQuery-Confirm-Footer-totalAmount.rar (1.82 kb)


See Live Demo

Protected by Copyscape Online Plagiarism Tool

Comments (6) -

jets jerseys
jets jerseys People's Republic of China
8/23/2011 4:29:25 AM #

You article is great, so I want to share with my friends.

patriots jerseys
patriots jerseys People's Republic of China
8/23/2011 4:30:04 AM #

thank you for sharing,I enjoyed the article.

barbour ashby
barbour ashby People's Republic of China
12/6/2011 4:21:12 PM #

There are many brands of barbour Shoreman Jacket in the market today. Each of the brand promises to bring out something new to the customers. barbour fusilier is also a renowned and reputed brand in the market. This brand is in fact reputed for the jackets barbour . You can purchase a Barbour enduro leather jacket and you would be amazed to find yourself. There are different varieties in the barbour jacket that you would get in the market.We will try to provide you few varieties of the barbour scott bracken jacket that are available in the market. The barbour jackets is basically a classically designed and styled Barbour combat coat. http://www.uk-barbourjacket.com/

Sree
Sree United States
12/22/2011 7:53:28 PM #

While you can go a buy a repeater to ensure that the signal strength is kept at an adequate level, you may already have an inexpensive router in your collection of extra network parts that can also serve as a repeater. By following the steps below, you will learn how to use a router as a repeater on your network. Thanks a lot.
Regards,
<a href="www.paradisevalleyrealestateusa.com/">Paradise Valley Real Estate</a>

replica tiffany jewelry
replica tiffany jewelry Malta
1/10/2012 10:22:18 PM #

This holiday season, http://www.discounttiffanyoutlet.com/ replica tiffany jewelry continues its tradition of spreading love with a glamorous centrepiece for WinterFest celebrations. Statue Square will feature a beautiful Christmas tree surrounded with a festive touch. Celebrate Christmas in the city ,make ride on the www.discounttiffanyoutlet.com/tiffany-necklaces/ tiffany necklaces,enjoying the www.discounttiffanyoutlet.com/tiffany-bangles/ tiffany bangle,or by sending a personalised www.discounttiffanyoutlet.com/tiffany-rings/ tiffany rings postcard to your loved ones to share some holiday treasures!

domain web hosting
domain web hosting India
1/30/2012 9:28:59 PM #

Useful informative, I am very happy to read this article..Thanks for giving us this useful info!

fddf
fddf People's Republic of China
3/31/2012 9:23:56 PM #

http://online-louisvuittonoutlet.com

fafafa
fafafa Slovenia
4/23/2012 2:32:54 AM #

http://www.christianlouboutinukk.org   christian louboutin
http://www.tiffanyuks.org   tiffany uk
http://www.gucciukbeltuk.org   gucci belt
http://www.frsaclouisvuittonsac.com   louis vuitton sac
http://www.chanelukoutletuks.org   chanel outlet
http://www.burberryukoutletuk.org   burberry
http://www.poloralphlaurenuko.org   ralph lauren uk

Pingbacks and trackbacks (3)+

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5