Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Prachi Vyas 10 posts 110 karma points
    May 11, 2019 @ 06:49
    Prachi Vyas

    How would I apply pagination

    Please help me for apply pagination on my this cards. Here I have added my code for cards.

            var selection = Umbraco.Content(Guid.Parse("3758071d-10c8-4890-b680-64f43a7b4149"))
            .Where(x => x.IsVisible())
            .OrderByDescending(x => x.Id);
        <div class="vehical_result">
            <div class="row">
                @foreach (var item in selection)
                    <div class="col-xl-4 col-lg-6">
                        <div class="caroffer_box">
                            <div class="img_car">
                                <a href="vehiclesdetails">
                                    <img src="@item.Value("vehicleImage")" alt="">
                                <div class="price_box">
                                    <p>From<br><span>[email protected]("pricePerWeek")p/w</span></p>
                            <div class="car_details">
                                <h6>Year: @item.Value("launchYear")</h6>
                                <p class="price">For sale <span>[email protected]("salePrice")</span></p>
                                <div class="caricon_section">
                                            <img src="/images/meter.svg" alt="">
                                            <p>@item.Value("meter") K mi</p>
                                            <img src="/images/speed.svg" alt="">
                                            <img src="/images/petrol.svg" alt="">
                                            <img src="/images/auto.svg" alt="">
            <div class="row">
                <div class="col-md-12 text-right vehicles_pagination">
                    <ul class="pagination">
                        <li class="page-item"><a class="page-link" href="#">Previous</a></li>
                        <li class="page-item"><a class="page-link active" href="#">1</a></li>
                        <li class="page-item"><a class="page-link" href="#">2</a></li>
                        <li class="page-item"><a class="page-link" href="#">3</a></li>
                        <li class="page-item"><a class="page-link" href="#">4</a></li>
                        <li class="page-item"><a class="page-link" href="#">5</a></li>
                        <li class="page-item"><a class="page-link" href="#">6</a></li>
                        <li class="page-item"><a class="page-link" href="#">7</a></li>
                        <li class="page-item"><a class="page-link" href="#">8</a></li>
                        <li class="page-item"><a class="page-link" href="#">9</a></li>
                        <li class="page-item"><a class="page-link" href="#">Next</a></li>
  • Søren Gregersen 441 posts 1884 karma points MVP 2x c-trib
    May 11, 2019 @ 11:58
    Søren Gregersen


    You would use Skip and Take (linq methods) om your selection variable. I would although not recommend this approach.

    Say you have 100 cars, you would then always load 100 cars and just take selection of them. Say you have a 1000 cars, the problem is 10 fold.

    Using the selection generated in the back office should not be used on large datasets.

    Instead you should use examine to find the cars, do sorting, pagination etc.

    Have a look at this article:

    HTH :-)

Please Sign in or register to post replies

Write your reply to: