title: Passing multiple parameters from url to html.actionlink
body: <p>I'm fairly new to MVC and am struggling with routing when I try to pass multiple parameters via the URL.</p>
  
  <p>From a page with the URL: <code>/PersonCAFDetail/Index/3?memberid=4</code></p>
  
  <p>...I'm trying to get an Html.ActionLink set to point to the Create action such that the id=3 and the memberid=4.</p>
  
  <p>Having read a number of similar posts it seems that the following should work:</p>
  
  <pre><code>@Html.ActionLink("Create New", "Create", null, new { memberid = "memberid" })
  </code></pre>
  
  <p>However, this results in a URL being created as follows:</p>
  
  <pre><code>&lt;a href="/PersonCAFDetail/Create/3" memberid="memberid"&gt;Create New&lt;/a&gt;
  </code></pre>
  
  <p>I have a route set up as:</p>
  
  <pre><code>    routes.MapRoute(
          name: "PersonCAFDetail",
          url: "PersonCAFDetail/Create/{id}/{memberid}",
          defaults: new { controller = "PersonCAFDetail", action = "Create", id = "@\d+", memberid = @"\d+" }                        
          );
  </code></pre>
  
  <p>The controller accepts two parameters as follows:</p>
  
  <pre><code> public ActionResult Create(int id, int memberid)
          {
              int cafID = id;
              int personID = memberid;
              ViewBag.detailTypeID = new SelectList(db.tCAFDetailTypes, "detailTypeID", "detailType");
              ViewBag.cafID = new SelectList(db.tFamilyCAFs, "cafID", "issues");
              ViewBag.personID = new SelectList(db.tPersons, "personID", "forename");
              return View();
          }
  </code></pre>
  
  <p>Any help appreciated.</p>
  
  <p>-------edit for model----------</p>
  
  <pre><code>namespace WhatWorks.Models
  {
      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Web;
      using System.Web.Mvc;
      using System.ComponentModel.DataAnnotations;
  
      public partial class tPersonCAFDetail
      {
          [Key, HiddenInput(DisplayValue=false)]
          public int cafID { get; set; }
  
          [Key, HiddenInput(DisplayValue = false)]
          public int personID { get; set; }
  
          [Key, HiddenInput(DisplayValue = false)]
          public int detailTypeID { get; set; }
  
          [Required, DataType(DataType.MultilineText)]
          public string notes { get; set; }
  
  
          public string FullName
          {
              get
              {
                  return tPerson.forename + " " + tPerson.surname;
              }
          }
  
          public virtual tCAFDetailType tCAFDetailType { get; set; }
          public virtual tFamilyCAF tFamilyCAF { get; set; }
          public virtual tPerson tPerson { get; set; }
      }
  }
  </code></pre>