Catching F4

3 posts, 0 answers
  1. Martin
    Martin avatar
    18 posts
    Member since:
    Jul 2011

    Posted 04 Dec 2012 Link to this post

    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. Svett
    Admin
    Svett avatar
    728 posts

    Posted 07 Dec 2012 Link to this post

    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.
  3. Martin
    Martin avatar
    18 posts
    Member since:
    Jul 2011

    Posted 07 Dec 2012 Link to this post

    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
Back to Top