That is the question! <BR><BR>I have a search page that builds a custom sql query based on the users input. The user is allowed to pick from any (or all) of the fields in a database table. When the user presses submit, a custom sql query is built, and the results are displayed in a datagrid. Simple enough, right? <BR><BR>The datagrid has a templatecolumn built in that contains a &#039;details&#039; button. On most of my pages, this button is linked to the &#039;id&#039; field in the database (obtained via a hidden bound column in my datagrid). When clicked, the button redirects the user to a details page, which gives them all the details of the record that they clicked. <BR><BR>In this instance, however, I can&#039;t link the &#039;details&#039; button to the id field, as a custom query is being built (which may or may not contain the id field). I could have the SQL query pre-built with the ID field already inserted, but that results in the id field being displayed in the datagrid whether the user wants it or not. <BR><BR>I guess I need either a way to have the ID field in the sql query so it&#039;s not displayed when autogenerate is set to true OR a way to have autogenerate set to false and have the datagrid automatically determine what fields where selected.<BR><BR>Does anyone have any suggestions for me? (code available upon request). <BR>