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

Catching F4

2 Answers 73 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 04 Dec 2012, 04:18 PM
For a particular textbox cell I'd like to catch the F4 key to open a popup window with a selection list. This, in itself, works fine. But I need the contents of the cell. So I get the cell value like this:
            Dim ThisRow As GridViewRowInfo = grdPositionen.MasterView.CurrentRow
            Dim Filter As String = ""
            If ThisRow.Cells(1).Value IsNot Nothing Then
                Filter = ThisRow.Cells(1).Value.ToString.Trim
                ....
But for some strange reason I don't get the actual contents of the cell, but the original contents instead. In other words; when the user just typed something else there, it's not in the Value property. How do I get the actual contents of the cell?

2 Answers, 1 is accepted

Sort by
0
Svett
Telerik team
answered on 07 Dec 2012, 11:37 AM
Hi Martin,

By following your code snippet, I am not sure in what case you are using it. Nevertheless, I assume that this behavior is caused by the fact that you have data source that implements IEditableObject interface. In that case, its EndEdit method is called when the current row is changed (in the same manner as Microsoft DataGridView). I recommend using the following code snippet to commit changes:
Dim editableObject As IEditableObject = TryCast(ThisRow.DataBoundItem, IEditableObject)
 
If editableObject IsNot Nothing Then
    editableObject.EndEdit()
End If

If the proposed solution does not solve the issue, please share with us a sample project or code snippet that demonstrates it.

Regards,
Svett
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
0
Martin
Top achievements
Rank 1
answered on 07 Dec 2012, 12:14 PM
Hi Svett,

Thanks for your reply. Your code snippet didn't solve the problem, however it did give me an idea on how to solve it and that worked:

 
Dim ThisRow As GridViewRowInfo = grdPositionen.MasterView.CurrentRow
Dim Filter As String = ""
 
If ThisRow.Cells(1).Value IsNot Nothing Then
    ThisRow.Cells(1).EndEdit()
    Filter = ThisRow.Cells(1).Value.ToString.Trim
End If

 

Regards,
Martin
Tags
GridView
Asked by
Martin
Top achievements
Rank 1
Answers by
Svett
Telerik team
Martin
Top achievements
Rank 1
Share this question
or