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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:18:26+00:00 2026-06-16T00:18:26+00:00

I am doing my homework in which I am developing a shopping site in

  • 0

I am doing my homework in which I am developing a shopping site in asp.net MVC 3 and currently I am doing my work only in views. I have a product page and on the click of details I have to open product detail page.

<a href="ProductDetails.cshtml"> Details </a>

I have multiple products and I want to tell my product detail page that which product details is opened. One way is this I can append Id with URL like

<a href="ProductDetails.cshtml?id=1"> Details </a>

But I am unable to understand how I can receive this id on the product detail page since I have no controller and no model and I am fetching data using compact database on the .cshtm page using server side code.

  • 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-06-16T00:18:27+00:00Added an answer on June 16, 2026 at 12:18 am

    You can access the query string using Request.QueryString["key"]. So I suppose you’ll want to use something like this:

    @{
        var myProductId = Request.QueryString["id"];
    }
    

    Caveat: Of course this is would be a bad practice, and normally the MVC pattern calls for you to pull the ID in your Controller’s action, fetch model data, and return that model data to the View. The View should know as little about things like the Query String, and any program logic, as possible.

    public class ProductController : Controller
    {
        public ActionResult ProductDetails(string id)
        {
            MyProduct model = SomeDataSource.LoadByID(id);
            return View(model);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As question states, I am doing homework which have 2 variables BOOK, and MAGAZINE
I'm doing a homework on data mining. Now I have a data set which
newbie doing Java homework here. I have one class named Album which contains the
while doing some homework in my very strange C++ book, which I've been told
I am doing homework but I have problem with non-RestFul routes. My spec is:
I'm doing some homework and while I have some experience with SML, Haskell has
A recent homework assignment I have received asks us to take expressions which could
Me and my friend having a problem while doing a homework assignment. We have
I am doing a little homework assignment in which we are making a very
I have a homework problem in which I'm supposed to write a function 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.