This is a migrated thread and some comments may be shown as answers.

[Solved] Get ID value on rowselect

2 Answers 96 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David Blok
Top achievements
Rank 1
David Blok asked on 09 Dec 2009, 01:23 PM

How can i get the value from the ID field of the database that is linked to the datagrid ?
    Protected Sub ToggleRowSelection(ByVal sender As ObjectByVal e As EventArgs)  
 
        CType(CType(sender, CheckBox).Parent.Parent, GridItem).Selected = CType(sender, CheckBox).Checked  
 
        Dim item As GridDataItem = TryCast((TryCast(sender, CheckBox)).Parent.Parent, GridItem)  
 
        Dim currentItemNumber As Integer = item.ItemIndex 'This works  
 
    End Sub 

I can get the itemindex but can't seem to get info from the columns

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 10 Dec 2009, 05:38 AM
Hello David,

You can access Text property of the cell by using the 'columnUniquName', as shown below.

      string itemValue = item["ID"].Text; //where dataItem is object of type GridDataItem

Also checkout the following documentation: Accessing cells and rows

Regards,
Shinu.
0
David Blok
Top achievements
Rank 1
answered on 10 Dec 2009, 07:45 AM
Hmm i used that code allready but now it works

prolly a typo, thanks a lot
Tags
Grid
Asked by
David Blok
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
David Blok
Top achievements
Rank 1
Share this question
or