Reputation: 2757
I am building a CRM. It displays information of customers in a GridView
. I have Selecting enabled on the GridView
. And when Selected, it shows a FormView
with more detailed information on the customer that was selected in the GridView
. This part is working fine.
I want to make the Customers Name in the Gridview
to be the select button that displays the FormView
.
My question is, How do I assign the same functionality that the auto generated Select button has, to any other field in the GridView
?
Upvotes: 1
Views: 2749
Reputation: 11433
You probably want to replace your "Customer Name" column markup with something like this:
<asp:ButtonField DataTextField="customerName" HeaderText="Customer Name" ButtonType="Link" CommandName="Select" />
This will still show your "Customer Name" data (because of the DataTextField
attribute), but it is now a LinkButton
that has the behavior of your previous "Select" button (because of the CommandName="Select"
).
For more information, see the MSDN documentation on the ButtonField class.
Upvotes: 1