If you have a DataGrid and wish to create a dynamic links using the data from the database, you can do so by using asp:hyperlinkcolumn and its 'DataNavigateUrlField' and 'DataNavigateUrlFormatString' fields.
If you wanted to create an edit page using the ID field as the dynamic QueryString and edit.aspx as the page to handle the QueryString and what ever commands you want, then this is more simple than you might imagine. An example of this is:
<asp:hyperlinkcolumn DataNavigateUrlField="id" Text="Edit" DataNavigateUrlFormatString="edit.aspx?id={0}" target="_blank" />
An example of this in a DataGrid is:
<asp:DataGrid ID="GridView1" runat="server" DataSourceID="SqlDataSource1" AutoGenerateColumns="False" DataKeyField="id">
<Columns>
<asp:BoundColumn DataField="id" Visible="False" />
<asp:BoundColumn DataField="name" HeaderText="Name" />
<asp:hyperlinkcolumn DataNavigateUrlField="id" Text="Edit" DataNavigateUrlFormatString="edit.aspx?id={0}" target="_blank" />
</Columns>
</asp:DataGrid>
To see how to configure a SqlDataSource to work with your DataGrid, click here