Copied to clipboard

Flag this post as spam?

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


  • charmila 3 posts 73 karma points
    Aug 22, 2017 @ 09:28
    charmila
    0

    Skip the blank pages on my form

    Hi all,

    My name is charmila and I'm new to Umbraco. I started developing forms. My issue is:

    There is a page with multiple select options. The page should navigate to the respective pages based on the conditions. I have applied the condition logic. Show this if * is *.

    The problem here is.. If it needs to navigate to the 10th page of the form and skip the 9 pages, it is displaying the blank pages for those 9 pages instead skipping it. My form has so many such options and in some cases need to click next for more than 20 times.

    It would be great if someone can help me with this.

    Many thanks in advance.

  • David Peck 690 posts 1896 karma points c-trib
    Aug 24, 2017 @ 09:46
    David Peck
    0

    Hi Charmila,

    I've not fully understood the issue, but can I suggest that you setup you page to use a p querystring to define the page of results e.g. www.mydomain.com/search?p=10

    Then if you want the 10th page of results you would just need to do:

    const itemsPerPage = 10;
    int pageNo;
    pageNo= int.TryParse(Request.QueryString["p"], out pageNo) ? pageNo: 1;
    
    var allResults = WhereYourResultsComeFrom();
    var pagedResults = allResults
                              .Skip((pageNo - 1) * itemsPerPage)
                              .Take(itemsPerPage);
    

    You'd then return allResults as part of your Model if you're using a controller. If this logic is just in the View then you can just do:

    @foreach(var result in pagedResults){
        @result.PropertyNameABC //Whatever data you need from your page result
    }
    

    I hope that is of some use.

  • charmila 3 posts 73 karma points
    Aug 31, 2017 @ 12:13
    charmila
    0

    Thank you so much for the response.

    I'm not sure where to add this code on. I have no knowledge on .net. I'm just trying to develop forms with few fields.

    Can you please let me know where can I add the coding part on the tool?

    Many thanks

  • David Peck 690 posts 1896 karma points c-trib
    Aug 31, 2017 @ 12:20
    David Peck
    0

    It's very tricky to quickly write how/where to put the code if you've no experience of .net. The quick answer is in the template. Have you checked out Umbraco TV? I think you might find that quite helpful. Otherwise you would really be looking to hire a developer to do this for you.

    You might find someone on www.upwork.com

  • charmila 3 posts 73 karma points
    Aug 31, 2017 @ 13:09
    charmila
    0

    Thank you for the prompt reply. Much appreciated.

    I will check the videos on Umbraco TV.

Please Sign in or register to post replies

Write your reply to:

Draft