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

[Solved] Loop through cells after double click

1 Answer 125 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mark Davison
Top achievements
Rank 1
Mark Davison asked on 26 Jan 2011, 07:49 PM
Hi,

I am sure this must be easy but I cannot see how to do it!

I am trapping the double click event on a cell and have a reference the the cell that was clicked. I want to get the names and contents of all the cells in the row. Can anyone help me? I have tried:

Public Sub OnCellDoubleClick(ByVal sender As Object, ByVal e As RadRoutedEventArgs)
    Dim cell As GridViewCellBase = TryCast(e.OriginalSource, GridViewCellBase)
    If cell IsNot Nothing Then
        Me.ClickedCell = cell
        Dim row As GridViewRow = cell.ParentRow
        Dim celllist As List(Of GridViewCellBase) = row.Cells
        
        Dim gc As GridViewCell
        For Each gc In celllist
            MessageBox.Show(gc.Visibility & " : " & gc.Name.ToString & ":" & gc.Value.ToString)
        Next
    End If
End Sub

 

 

but this does not seem to give me all the cells.

Secondly, we need to have some "invisible" cells to store data that we need when teh row is double clicked etc. How can I access the values in these cells where IsVisible=False.

Regards,

Mark

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 28 Jan 2011, 02:11 PM
Hi Mark Davison,

The name of the cells would be the default, which is an empty one. As far as the rest of the cells' properties are concerned, I have managed successfully to get them using the code you provided. I am sending you the sample project I used for testing your scenario.
Considering your second requirement, it would be better to expose a new property in your business object that will keep the data you want to  save. So, no matter that its corresponding column will be invisible, you would still be able to get the value of that data by getting the value of the property. 

Greetings,
Maya
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
GridView
Asked by
Mark Davison
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or