Get cell string value from datagrid

N

Niclas Lindblom

Hi,

I have a datagrid with 2 columns. 1 is a bound column and the other one is a
button column configured as a link button. When I click the link button, the
ItemCommand Event fires as it is supposed to. I am able to get the value
from the first column using

e.item.cells(0).text

but I need to get the string value from the link button that was clicked, So
obviously I thought I would get that from

e.item.cells(1).text

But this always returns a empty string....

Am I doing something wrong, or is there another way I can get this value ?


Regards

Niclas
 
A

alec maclean

Niclas,

In your ItemCommand procedure, do this:

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'Respond to item being clicked
Dim btn As LinkButton = CType(e.CommandSource, LinkButton)

Select Case btn.Text
Case "Details"

....etc...

End Select
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Regards,

Alec
 
N

Niclas Lindblom

Cool, Thanks !

alec maclean said:
Niclas,

In your ItemCommand procedure, do this:

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'Respond to item being clicked
Dim btn As LinkButton = CType(e.CommandSource, LinkButton)

Select Case btn.Text
Case "Details"

...etc...

End Select
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Regards,

Alec
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top