Hi Does anyone know how to add a button link to a grid view to a single row in a grid view, rather than the entire column?
At the moment I have this:
|
Customer |
Sales |
|
Customer A |
1000 |
|
Customer B |
1005 |
|
Customer C |
2500 |
However I want this:
|
Customer |
Sales |
|
Customer A |
1000 |
|
Customer B |
1005 |
|
Customer C |
2500 |
I have created this first grid view using the following :
http://technico.qnownow.com/using-gridview-in-asp-net-c-part-2/
Thank you for your help.
Suthish NairRank #93 · 22.6K pointsPosted Mar 27, 2013, 1:07 AM EDT
Lynn Emery30 pointsPosted Mar 27, 2013, 1:11 AM EDT
Please could explain furher how I can hide the link.
Again, Thank you for your help.
Suthish NairRank #93 · 22.6K pointsPosted Mar 27, 2013, 1:37 AM EDT
Add two control, LinkButton and Label for column Customer. Both will bind with same value.
Make sure any one of the control should be visible all the time.
Now on GridView RowDataBound event check if e.Row.RowIndex == 0 (this means first row) then show LinkButton only and hide Label. Else for another row, hide LinkButton.