Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make one field of Gridview the select link?

In ASP.NET 3.5, you can assign a Select link and change what the link actually displays. But can you you assign one of the fields in the gridview to act as a select button?

For instance, all my records have a "SAMPLE ID" Field. It would be great to have each unique SAMPLE ID be a link that goes to the details view. I cannot find any setting under the gridview 'edit columns' that appears to assign that behavior to a certain field.

I know this has to be possible because I rarely see ASP.NET websites that actually use the "Select" link on the side - most of them let you click one of the fields.

How can I do this?

Using Visual Studio 2008, ASP.NET 3.5, and C# 3.0!

like image 841
Brett Avatar asked Jan 19 '26 09:01

Brett


1 Answers

I would add a ButtonField with the DataTextField as the database table column you want to bind it to, and make the CommandName "Select". I just did this in Visual Web Developer 2008 Express on a GridView and it worked. Good luck!

like image 171
Thomas Arnold Avatar answered Jan 21 '26 21:01

Thomas Arnold



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!