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

[Solved] Problem Retrieving values from GridButtonColumn

1 Answer 144 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Filip
Top achievements
Rank 1
Filip asked on 25 Apr 2008, 10:54 PM
I have a grid bound to a dataset.
I am displaying one of the values in the grid as a GridButtonColumn.
When I click on this button, I would like to fetch the value from the
grid and load an object from the database.

Now in my ItemCommand handler I am trying to do:
RadGrid.MasterTableView.Items(e.Item.ItemIndex).Item("OpportunityIDColumn").Text

What I am expecting is the value that I see in the grid (which is 2534, let's say)
but what this returns is '$nbsp;' .
The strange thing is that I had this working yesterday, and today when I added a column, this problem showed up and now I can't get it to work again.  Has anyone seen this?

Thank you for you attention everyone,
Filip

1 Answer, 1 is accepted

Sort by
0
Vladimir
Top achievements
Rank 1
answered on 26 Apr 2008, 06:58 AM
Filip,

You can use DataKeyNames/DataKeyValues to achieve this. Here is an example:
...
<MasterTableView DataKeyNames="OpportunityIDColumn" ...
...
If TypeOf e.Item Is GridDataItem Then
  Dim MyValue As Object =  CType(e.Item, GridDataItem).GetDataKeyValue("OpportunityIDColumn")
End If
Tags
Grid
Asked by
Filip
Top achievements
Rank 1
Answers by
Vladimir
Top achievements
Rank 1
Share this question
or