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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:49:38+00:00 2026-05-20T00:49:38+00:00

Related post: Populating a select box in a form using related ID in MVC3

  • 0

Related post: Populating a select box in a form using related ID in MVC3

I’ve got a Listview generated using MVC3 and ADO.NET Linq-to-Entities.

I have been able to create a simple list view, with an “Create” & “Edit” Action Link Command for creating a ‘related object’.

 @Html.ActionLink("Create Shipping Profile", "../PrintProfile/Create", new { id = item.ProductId }) |
 @Html.ActionLink("Edit Shipping Profile", "../PrintProfile/Edit", new { id = item.ProductId })

When I create the ‘PrintProfile’ I want the ‘Create’ view to be ‘pre-populated’ with the “ProductId” (which is the database table relation), so that I can create the profile, and edit the associated profile for each item in the list.

Here is the Create Controller for the PrintProfile:

    public ActionResult Create(int ProductId)
    {
        var entities = new CS_ShippingProfiles();
        entities.ProductId = ProductId; // Assign the ProductId I want to 'create'
        return View(entities);
    }

    [HttpPost]
    public ActionResult Create(CS_ShippingProfiles Profile)
    {
        if (ModelState.IsValid)
        {
            var entities = new LabelServiceEntities();
            entities.AddToCS_ShippingProfiles(Profile);
            entities.SaveChanges();

            return Redirect("/Products");
        }
        return View(Profile);
    }

But When I follow the link, I get a ‘Null’ parameter exception! What am I doing wrong?!

  • 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-20T00:49:38+00:00Added an answer on May 20, 2026 at 12:49 am

    Your action parameter on the Create action is called ProductId so make sure you generate correct links:

    @Html.ActionLink(
        "Create Shipping Profile", 
        "Create", 
        "PrintProfile", 
        new { ProductId = item.ProductId }, 
        null
    ) 
    |
    @Html.ActionLink(
        "Edit Shipping Profile", 
        "Edit", 
        "PrintProfile", 
        new { ProductId = item.ProductId }, 
        null
    )
    

    Also notice how controller and actions are specified instead of using some relative urls as you do (../PrintProfile/Create).

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

Sidebar

Related Questions

I am using jquery's $.post for ajax (like populating a selectbox with a value
A related post here pretty much established reflection in Java as a performance hog.
On a related post I mentioned that I have found custom HTML helpers to
This question is related to the post about having abstract at the titlepage. I
This question is related to a previous post of mine Here . Basically, I
I read all the related post but I think I am missing something. My
I have seen a similar related post but my situation is a little different
Following a suggestion on a related post ( see here ), I was wondering
This is a sequel to a related post which asked the eternal question: Can
This post is related to my Previous Post . There I was creating the

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.