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

BeginEdit() on Cell not working from within CellEndEdit event handler

3 Answers 570 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Christopher
Top achievements
Rank 1
Christopher asked on 05 Mar 2010, 05:40 PM
I am trying to validate values being entered into my grid real-time in the CellEndEdit event handler.  If I find that the value entered is not valid, I push a message to the user and want to fire the BeginEdit on that same field, to keep them there until they enter something valid.

I cannot kickoff the BeginEdit method successfully on the cell.  Sifting through this forum, I found some "like" problems and tried implementing some suggested techniques, all with no success.  Below is some sample code.

Private Sub grdMain_CellEndEdit(ByVal sender As ObjectByVal e As Telerik.WinControls.UI.GridViewCellEventArgs) Handles grdMain.CellEndEdit 
 
    If e.Row.Cells(2).Value.ToString <> "" Then 
        If e.Row.Cells(2).Value.ToString.ToUpper <> "TRUE" And e.Row.Cells(2).Value.ToString.ToUpper <> "FALSE" Then 
            e.Row.Cells(2).Selected = True 
            e.Row.Cells(2).CellElement.IsCurrent = True 
            e.Row.Cells(2).BeginEdit() 
        End If 
    End If 
 
End Sub 


The BeginEdit does not fire, but the cell is selected in the grid.

Regards,
Christopher Thumann

3 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 08 Mar 2010, 09:29 AM
Hello Christopher,

Thank you for writing. RadGridView provides RowValidating and CellValidating events similar to Microsoft DataGridView ones. Please use those instead.

Kind regards,
Victor
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Christopher
Top achievements
Rank 1
answered on 08 Mar 2010, 03:24 PM
You didn't explain why what I am trying to do isn't working.  By your documentation, it should.

Chris
0
Victor
Telerik team
answered on 10 Mar 2010, 10:01 AM
Hi Christopher,

Please post the link to the documentation page you mentioned. Also please refer to this page which demonstrates CellValidating event. There is property named CloseEditorWhenValidationFails. You can set it to false and when your users enter invalid data and the editor will remain open. Thank you for the feedback and write again if you need further assistance.

Kind regards,
Victor
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Christopher
Top achievements
Rank 1
Answers by
Victor
Telerik team
Christopher
Top achievements
Rank 1
Share this question
or