Skip to main content
CSharpUniversity ASP.NET and C# lessons

The search runs entirely in your browser over the published lesson list.

Adding a link column to the grid

A grid of plain text is a dead end. A link column lets each row lead somewhere useful, usually to a detail or edit page.

A bound link column

Markup
<asp:HyperLinkField
    DataTextField="Name"
    DataNavigateUrlFields="Id"
    DataNavigateUrlFormatString="detail.aspx?id={0}"
    HeaderText="Product" />

How the pieces fit

  • The text field is what the visitor reads.
  • The navigate url fields supply values for the address.
  • The format string places those values into the address.
Never trust the identifier in the address. A visitor can change it. On the detail page, check that the record exists and that the visitor is allowed to see it.

That detail page usually uses a form view, covered in showing one record in a form view.

New lessons by email

Leave your address and get a short note whenever a fresh lesson is published. No account needed and you can stop at any time.

Thank you. Your address has been noted in this browser session. Connect a mailing service to deliver the notes for real.