title: Missing asp-route-id value in asp-page for Delete in Razor Page .Net Core 2.1
body: <p>We have this very weird TournamentBatch Razor Page (index.cshtml) where we have something like this:</p>
  
  <pre><code>&lt;td&gt;
                  &lt;a asp-page="/TournamentBatchItems/Index" asp-route-id="@item.TournamentBatchID"&gt;Items&lt;/a&gt; |
                  &lt;a asp-page="./Edit" asp-route-id="@item.TournamentBatchID"&gt;Edit&lt;/a&gt; |
                  &lt;a asp-page="./Details" asp-route-id="@item.TournamentBatchID"&gt;Details&lt;/a&gt; |
                  &lt;a asp-page="./Delete" asp-route-id="@item.TournamentBatchID"&gt;Delete&lt;/a&gt;
              &lt;/td&gt;
  </code></pre>
  
  <p>and when we are running this and end up that there is no id returned on the page just for /Delete link and other links are ok (/TournamentBatchItems/Index, /Edit, /Details). </p>
  
  <p>This is the html source looks like:</p>
  
  <pre><code>&lt;td&gt;
                  &lt;a href="/TournamentBatchItems?id=5088415a-f491-4438-1aa9-08d642f7dffe"&gt;Items&lt;/a&gt; |
                  &lt;a href="/TournamentBatches/Edit?id=5088415a-f491-4438-1aa9-08d642f7dffe"&gt;Edit&lt;/a&gt; |
                  &lt;a href="/TournamentBatches/Details?id=5088415a-f491-4438-1aa9-08d642f7dffe"&gt;Details&lt;/a&gt; |
                  &lt;a href=""&gt;Delete&lt;/a&gt; |
              &lt;/td&gt;
  </code></pre>
  
  <p>Now other pages for Delete are OK only this page. ?!?!</p>
  
  <p>Any ideas?</p>
  
  <p>Index Pagemodel:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Threading.Tasks;
  using Microsoft.AspNetCore.Mvc;
  using Microsoft.AspNetCore.Mvc.RazorPages;
  using Microsoft.EntityFrameworkCore;
  using AthlosifyWebArchery.Data;
  using AthlosifyWebArchery.Models;
  using AthlosifyWebArchery.Utilities;
  using CsvHelper;
  using System.IO;
  
  namespace AthlosifyWebArchery.Pages.TournamentBatches
  {
      public class IndexModel : PageModel
      {
          private readonly AthlosifyWebArchery.Data.ApplicationDbContext _context;
  
          public IndexModel(AthlosifyWebArchery.Data.ApplicationDbContext context)
          {
              _context = context;
          }
  
          public IList&lt;TournamentBatch&gt; TournamentBatches { get;set; }
  
          public async Task OnGetAsync()
          {
              TournamentBatches = await _context.TournamentBatch.ToListAsync();
          }
  
  
  
      }
  }
  </code></pre>
  
  <p>Delete Pagemodel:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Threading.Tasks;
  using Microsoft.AspNetCore.Mvc;
  using Microsoft.AspNetCore.Mvc.RazorPages;
  using Microsoft.EntityFrameworkCore;
  using AthlosifyWebArchery.Data;
  using AthlosifyWebArchery.Models;
  
  namespace AthlosifyWebArchery.Pages.TournamentBatches
  {
      public class DeleteModel : PageModel
      {
          private readonly AthlosifyWebArchery.Data.ApplicationDbContext _context;
  
          public DeleteModel(AthlosifyWebArchery.Data.ApplicationDbContext context)
          {
              _context = context;
          }
  
          [BindProperty]
          public TournamentBatch TournamentBatch { get; set; }
          public string ConcurrencyErrorMessage { get; set; }
  
          public async Task&lt;IActionResult&gt; OnGetAsync(Guid? id, bool? concurrencyError)
          {
              if (id == null)
              {
                  return NotFound();
              }
  
              TournamentBatch = await _context.TournamentBatch
                                          .AsNoTracking() //Addded
                                          .FirstOrDefaultAsync(m =&gt; m.TournamentBatchID == id);
  
              if (TournamentBatch == null)
              {
                  return NotFound();
              }
  
              if (concurrencyError.GetValueOrDefault())
              {
                  ConcurrencyErrorMessage = "The record you attempted to delete "
                    + "was modified by another user after you selected delete. "
                    + "The delete operation was canceled and the current values in the "
                    + "database have been displayed. If you still want to delete this "
                    + "record, click the Delete button again.";
              }
  
              return Page();
          }
  
          public async Task&lt;IActionResult&gt; OnPostAsync(Guid? id)
          {
              /*if (id == null)
              {
                  return NotFound();
              }
  
              TournamentBatch = await _context.TournamentBatch.FindAsync(id);
  
              if (TournamentBatch != null)
              {
                  _context.TournamentBatch.Remove(TournamentBatch);
                  await _context.SaveChangesAsync();
              }
  
              return RedirectToPage("./Index");
              */
  
              try
              {
                  if (await _context.TournamentBatch.AnyAsync(
                      m =&gt; m.TournamentBatchID == id))
                  {
                      // Department.rowVersion value is from when the entity
                      // was fetched. If it doesn't match the DB, a
                      // DbUpdateConcurrencyException exception is thrown.
                      _context.TournamentBatch.Remove(TournamentBatch);
                      await _context.SaveChangesAsync();
                  }
                  return RedirectToPage("./Index");
              }
              catch (DbUpdateConcurrencyException)
              {
                  return RedirectToPage("./Delete",
                      new { concurrencyError = true, id = id });
              }
          }
      }
  }
  </code></pre>