Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A very direct way to do this would be to add a parameter to the link in each item in the list. So instead of something like this:</p> <pre><code>&lt;a href="detailspage.aspx"&gt;View Details&lt;/a&gt; </code></pre> <p>You'd have something like this:</p> <pre><code>&lt;a href="detailspage.aspx?id=123"&gt;View Details&lt;/a&gt; </code></pre> <p>Naturally, each <code>id</code> would be different for each row. How you populate that depends on how you populate the listview.</p> <p>Then you'd have a single <code>detailspage.aspx</code> (or whatever you call it) which would look for an <code>id</code> parameter (check the <code>Request.QueryString["id"]</code> value in <code>Page_Load</code> for web forms, or have it as a method parameter in MVC) and use that value to fetch the record from the database and display the details.</p> <p>One thing that's very much worth noting in this case is the need to validate that input before sending it to a database. You didn't specify how you're accessing the database, so I can only guess. But, regardless of your data access methodology, the <em>first</em> thing you want to do with that <code>id</code> value on the details page is to make sure it's a valid value to use for selecting data.</p> <p>For example, if the identifier in the database is an integer, you'll want to try to parse the value into an actual integer variable (if it's a string by default, which it would be from <code>Request.QueryString</code>), returning an error to the page if that fails. Or if it's a GUID, same process. Basically, you want to do whatever you can to ensure that the value is safe for the database before even connecting to the database.</p> <p>More details on SQL injection vulnerabilities <a href="http://en.wikipedia.org/wiki/SQL_injection" rel="nofollow">here</a>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload