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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:37:02+00:00 2026-05-23T07:37:02+00:00

I am working on my first MVC 3 application and am stumped by the

  • 0

I am working on my “first” MVC 3 application and am stumped by the following issue. Basically I have a Contact form that gathers input and saves to the db. On a page listing all Contact submissions, I want the user (this will be Admin role in the future) to be able to select a single Contact from the Contact list page and click “Make Client” to call my ClientController and convert this Contact into a Client. The ClientController page also has a Create() method to enter a new Client record from scratch, so to avoid complexity in that method, I am attempting to create a “Make” action that accepts a contactID as a parameter.

I have the following code on the Contact List page:

@Html.ActionLink("Make Client", "Make", "Client", new { id = item.ID }, null)

With the client controller appearing as thus:

    [HttpGet]
    public ActionResult Create()
    {
        return View(new Client());
    }

    //
    // GET: /Make
    //  used for converting a Contact record into a Client
    [HttpGet]
    public ActionResult Make(int contactID)
    {
        try
        {
            var contactModel = _db.Contacts.Single(r => r.ID == contactID);

            var clientModel = new Client()
            {
                FirstName = contactModel.FirstName,
                LastName = contactModel.LastName,
                <snip> . . . ,
                ZipCode = contactModel.ZipCode
            };

            return View(new Client(clientModel));
        }
        catch (Exception ex)
        {

            base.ViewData["Exception"] = "Exception: " + ex.InnerException.ToString();
            throw;
        }
    }

The problem is that the contactID received in Make(int contactID) is always null. I have been able to tweak some things to get the following to work by calling the standard Create() ActionResult with a nullable int parameter, but this feels hokey:

    [HttpGet]
    public ActionResult Create(int? id)
    {
        if (id == null)
        {
            return View(new Client());
        }
        else
        {
            return (Make(id));
        }
    }

The bottom line is that I can call this Create() ActionResult the parameter is not null, but when I call Make() directly, the parameter is not passed along. Is there something special about Create() that makes this work?

Thanks, and I am open to other alternatives as well.

  • 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-23T07:37:03+00:00Added an answer on May 23, 2026 at 7:37 am

    The action argument of the Make action is called contactID, so when generating the link to this action use this name:

    @Html.ActionLink(
        "Make Client", 
        "Make", 
        "Client", 
        new { contactid = item.ID }, 
        null
    )
    

    This will successfully pass the correct value as argument when invoking the Make action. So you no longer need the tweak in the Create action.

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

Sidebar

Related Questions

I'm working on my first ASP.NET MVC application and have a strange issue. All
I'm working on an asp.net MVC application. I have a class that wraps a
I am working on an asp.net MVC 3 web application, i have the following
I am currently working on my first asp.net mvc application. I am trying to
I am working on my second multitenant MVC application. My first did not use
I am working on an MVC site that is the first my company has
I have pretty much finished my first working Symbian application, but in my hastened
I am new to wpf and i am working on first application i have
I am working on my first MVC application and am running into a bit
First some background, I am currently working on a relatively large Asp.Net MVC application

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.