views:

34

answers:

2

I have a datagrid with 3 of 5 fields from a SQL table. The first databound was changed to an asp:hyperlink so the field can be clicked. What I want to do is, when the user clicks an object in the field, it sends the ID to another page. From there, it uses the request in order to display the required information which is found in the same SQL table.

For example:

User clicks on a cell in the first column, it brings them to a page with more information on that cell.

How would I do this?

+1  A: 

It sounds like what you are trying to do is pretty similar to that on the Master-Details (Separate Pages) sample here. You need to set the DataNavigateUrlFormatString and DataNavigateUrlFields

Martin Smith
A: 

I ended up using this:

<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%#Eval("CareerID", "~/Description.aspx?id={0}") %>'  Text='<%# Eval("Title") %>'></asp:HyperLink>

And then on the other page:

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ASPNETDBConnectionString %>"
                    SelectCommand="SELECT * FROM [c_Careers] WHERE ([CareerID] = @CareerID)">
                    <SelectParameters>
                        <asp:QueryStringParameter Name="CareerID" QueryStringField="id" Type="Int32" />
                    </SelectParameters>
                </asp:SqlDataSource>
BioXhazard