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 6113875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:54:33+00:00 2026-05-23T14:54:33+00:00

I am currently going nuts making a page to display the contents when an

  • 0

I am currently going nuts making a page to display the contents when an ID is passsed to it.
The code i have can be found below

 @{  
Layout = "~/_SiteLayout.cshtml";
Page.Title = "Home";
var db = Database.Open("StarterSite");
 var PageID  = UrlData[0]; 
 if (PageID.IsEmpty()) { 
     PageID = "1";
 } 
var pages = db.QuerySingle("SELECT * FROM PAGES WHERE Id = @0",PageID);

}

        <div class="productInfo">
            <h3>@pages.Body</h3>
            </div>

Basically what i am trying to get it to do is when you enter the url default/1 that the body of the page which has an id of 1 will appear and that if no querystring is given it will default to ID 1

When i run this i get an error with the line

@pages.Body

stating Exception Details: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot perform runtime binding on a null reference

the URL passed is http://localhost:20756/Default/1 and there is a page with an ID of 1 in the system

  • 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-23T14:54:33+00:00Added an answer on May 23, 2026 at 2:54 pm

    the exception in other words:

    your runtime said:

    “you gave me a query that did not
    return anything, but want me to access
    some data on that result … errm …
    that’s not going to happen”

    if this code runs in your default.cshtml, try removing “Default/” from your url …

    note that PageID.IsEmpty() is not evaluating to true since UrlData[0] will probably contain "Default"

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently on my website visitors can directly access different posts by going to www.mywebsite.com/index.php?post=123,
I'm going to assume that the overall structure of my code as it currently
I'm going nuts over this. I can write to a cookie, and then read
I am currently going through the tutorial examples on http://code.google.com/p/stanford-cs193g-sp2010/ to learn CUDA. The
I need some help here, I'm currently going round in circles. I have a
I have been going nuts with this.. I have gnupg installed on my CentOS
I'm currently going over my user registration code. The part I'm focusing on right
Going nuts over here... From within the shell, I can do: product.tags.add(a_new_tag) The tag
I am currently going through one of the Android Tutorials . I found an
We are currently going through the long process of writing some coding standards for

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.