Copied to clipboard

Flag this post as spam?

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

  • Ryan 34 posts 137 karma points
    Apr 29, 2015 @ 16:22

    Identifying destination page dynamically

    Hi all,

    I'm hoping someone can help me improve my current solution to a problem I'm having. I have a document type 'Product' - I've made three pages using this document type, lets call these page 1, page 2 and page 3. No matter what page of the three is requested it will always pass through the controller action below, depending on the page requested I must show different records.

    See below for my current simplified solution.

    public class ProductController : RenderMvcController
    public override ActionResult Index(RenderModel model)
         if (model.Content.Id == page1Id)
               //do something 
         return base.Index(model);
     public static int page1Id= 999;
     public static int page2Id= 888;
     public static int pag3Id= 777;

    The problem is if the page Id's ever change then the whole system is going to fall down, likewise I don't really like comparing on the content name for the reason stated above - I'm trying to make this section as adaptive as possible.

    If anyone has any suggestions that would be great.


Please Sign in or register to post replies

Write your reply to: