I have GridView that allows select. It takes data from EntityDataSource. How do I get the entity Object that is selected when the row in GridView is selected ?
Primary keys of entities are not displayed in the GridView.
Thanks for answers
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you’re using a template field in your gridview, you can pass the primary key in the CommandArgument property for your select command. Example:
Then, when the user clicks the “select” button, this triggers a “RowCommand” event on your gridview. If you capture this event and check the e.CommandArgument property, you’ll be able to gain access to the primary key corresponding to the row they selected:
Hope this helps!