title: mvc4 actionlink passing variable
body: <p>So I got this webproject i'm working on, and in 4/5 views Im using </p>
  
  <pre><code> @Html.ActionLink("Back to List", "Index", new { id=Model.ClientID})
  </code></pre>
  
  <p>All of the views return me to my list exept my "Create New View"
  This will also be the only view not to load, giving me the exeption of "System.NullReferenceException"</p>
  
  <p>I'm confused on why this is the only view that won't let me pass a clientID to it ( since i need not only it but also the CountyID to create a new County, And more so telling me that it is null.</p>
  
  <p>If i remove the line of code above my code runs fine ( exept adding my 2 ID fields into the create view obviously ) wich made me think it may be my controller.</p>
  
  <p>Here is my action from givin controller for create</p>
  
  <pre><code>    // GET: /County/Create
      public ActionResult Create()
      {
          return View();
      }
  </code></pre>
  
  <p>for comparison here is an edit action in the same controller </p>
  
  <pre><code>    public ActionResult Edit(int id = 0)
      {
          dbCounty countys = db.Countys.Find(id);
          if (countys == null)
          {
              return HttpNotFound();
          }
          return View(countys);
      }
  </code></pre>
  
  <p>I've also tryed adding this code to the create new actionlink wich is when i get this error</p>
  
  <pre><code>HTTP Error 404.0 - Not Found
  The resource you are looking for has been removed, had its name changed, or is temporarily         unavailable.
  Most likely causes:
  
  The directory or file specified does not exist on the Web server.
  The URL contains a typographical error.
  A custom filter or module, such as URLScan, restricts access to the file.
  </code></pre>
  
  <p>What am i doing wrong here ....</p>
  
  <p>My project is build on a hierachy model, One Client Many Countys ( if you need more code let me know ) </p>
  
  <p>thanks in advance.</p>
  
  <p><strong>Tip:</strong></p>
  
  <p>there must be a reason ( my assumption ) why when removing this line of code it works ( so it must be this line of code ?? ) - must be a different way of passing it ( clientID does have a value of 1 ) </p>
  
  <pre><code> @Html.ActionLink("Back to List", "Index", new { id=Model.ClientID})
  </code></pre>
  
  <p>Edit Index Controller needed : </p>
  
  <pre><code>    public ActionResult Index([Bind(Prefix="id")] int CID=0)
      {
          var clnt = db.Clients.Find(CID);
  
          if (clnt != null)
          { 
              return View(clnt);
          }
  
          return HttpNotFound();
  
       }
  </code></pre>
  
  <p>EDIT: new create action from Countys Controller</p>
  
  <pre><code>    public ActionResult Create(int id=0)
      {
          dbCounty countys = db.Countys.Find(id);
          if (countys == null)
          {
              return HttpNotFound();
          }
          return View(countys);
      }
  </code></pre>
  
  <p>i have also tryed running </p>
  
  <pre><code>    public ActionResult Create(int id=0)
        {
          dbClient Client = db.Clients.Find(id);
          if (Client == null)
          {
              return HttpNotFound();
          }
          return View(Client);
      }
  </code></pre>
  
  <p>( since i am passing a clientID - the way the models are built it should add a county id while creating this new row in the database with the clientID(passedVariable)</p>