Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Get cell string value from datagrid

Reply
Thread Tools

Get cell string value from datagrid

 
 
Niclas Lindblom
Guest
Posts: n/a
 
      04-21-2004
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


 
Reply With Quote
 
 
 
 
alec maclean
Guest
Posts: n/a
 
      04-21-2004
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


"Niclas Lindblom" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
 
Niclas Lindblom
Guest
Posts: n/a
 
      04-21-2004
Cool, Thanks !

"alec maclean" <(E-Mail Removed)_SPAM> wrote in message
news:(E-Mail Removed)...
> 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
>
>
> "Niclas Lindblom" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> 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
>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
datagrid - get the row's column value when clicking on a hyperlink cell vndaxanh@yahoo.com ASP .Net 2 01-23-2006 06:19 PM
How to set cell background based on cell value when datagrid is displayed RJ ASP .Net Datagrid Control 1 02-17-2005 09:37 PM
datagrid-how to get cell value(hyperlink column) =?Utf-8?B?UGF1bA==?= ASP .Net 9 10-12-2004 11:39 PM
Get value from datagrid DDL cell OnSelectedIndexChange steve roszko ASP .Net 1 08-12-2003 08:46 PM
moving to cell Y if cell X has value Z. Clarke Rice Computer Support 0 06-30-2003 09:35 AM



Advertisments