Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6944039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:14:02+00:00 2026-05-27T13:14:02+00:00

Background: I have two web pages, one is a list of things, and the

  • 0

Background: I have two web pages, one is a list of things, and the other is the detail of the thing. On the list, the user can filter and sort, which results in a sorted list. On the details, I would like the user to have Next and Previous navigation.

I’m using ASP.Net Web Pages with Razor, edited with either WebMatrix or Visual Studio. The code on the list page is simple. The RefID is an integer Key uniquely identify the record:

var db = Database.Open("dbname");
...
var q = db.Query( sqlthatworks , passInVarables);
Session["WorkingList"] = q.Select( x => new { x.RefID } );

On the details page, I need to be able to access the Session[“WorkingList”] such that I can use the Linq provided by this StackOverFLow question to find the next and previous records, which will be something like:

var workingList = (IEnumerable<dynamic>) Session["WorkingList"];
var nextRecord = workingList.SkipWhile(i => i.RefID != currentRecord).Skip(1).First();

I know that db.Query returns a IEnumerable< Object>, but I’m guessing what’s really coming back is a IEnumerable< dynamic >. And that works, but seems overly complicated. Is there a better way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:14:03+00:00Added an answer on May 27, 2026 at 1:14 pm

    You’re much better off creating a class for the RefID value. This will allow you to do this:

    public class RefContainer {
        // maybe RefID is not an int...?
        public Int32 RefID { get; set; }
    }
    
    Session["WorkingList"] = q.Select(x => new RefContainer { RefID = x.RefID });
    
    var workingList = Session["WorkingList"] as IEnumerable<RefContainer>;
    if (workingList != null) {
        var nextRecord = workingList
            .SkipWhile(i => i.RefID != currentRecord)
            .Skip(1).First();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web page which loads in two different ways; user can click
Background: We have two directories of Crystal Reports for both the web side of
I have two images in the background of my html doc. One positioned top
First, a little background. I have two ASP.NET web applications that use SQLServer session
Background information Let's say I have two database servers, both SQL Server 2008. One
Hi everyone let me explain this issue: Background: I have two web applications The
Ill try to explain this as best I can. I have two web servers.
I have two page in one directory for an iOS web app. One is
Some Background We have a team of four developers and we have two web
Background I have two lists, the first is items which contains around 250 tuples,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.