What I’m trying to accomplish is when I click a button in my gridview, the values of that particular row must be displayed in textlabels lblID, lblName, …
I just don’t have a clue how to do it.
This is the code of my sqldatasource:
<asp:SqlDataSource ID="srcProd" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnDB %>"
ProviderName="<%$ ConnectionStrings:ConnDB.ProviderName %>"
SelectCommand="SELECT p.tProdID, p.tProdImage, p.tProdBeschrijving, m.tMerkNaam, m.tMerkImage, p.tProdVerkoop FROM tblProducten AS p INNER JOIN tblMerken AS m ON p.tMerkID = m.tMerkID ORDER BY m.tMerkNaam">
</asp:SqlDataSource>
This is a screenshot of the gridview I’m talking about.

When I press one of the buttons I would like e.g. the parameter ID displayed in lblID.
All help, hints and tips are appreciated.
Assign a
CommandName(which is like “ShowDetails” or so) and aCommandArgument(which is the ID of the record) to the button. A click on the button will now trigger the grid’sRowCommandevent, passing you bothCommandNameandCommandArgumentine. Then fetch the record from your DB and populate your controls: