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

Cell Validating keep edit in current cell

2 Answers 128 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Armand
Top achievements
Rank 1
Armand asked on 07 Jan 2009, 03:23 PM
I am trying to set edit back to cell if no value is entered.
I am using the validating event.
It traps the empty event nicely but when I try to move focus and edit back to the empty cell if refuses and jump to next column in same row.
My code is as follow:


'get column number  
        Dim col As Int32 = Me.RadGridView1.Columns.IndexOf(Me.RadGridView1.CurrentColumn)  
        'test first if valid lognumber  
        If col = 0 Then  
            Dim input As String = (Me.RadGridView1.ActiveEditor.Value.ToString())  
            If input = "" Then  
                MsgBox("empty")  
                e.Cancel = True 
                Me.RadGridView1.Rows(0).IsCurrent = True 
                Me.RadGridView1.Columns(0).IsCurrent = True 
                Me.RadGridView1.BeginEdit()  
            End If  
        End If 

Thank you

 

 

 

 

 

 

 

2 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 09 Jan 2009, 10:00 AM
Hi Armand,

Thank you for the question.

RadGridView does not currently support this behavior. However, there is a way to prevent the user from leaving the cell in case of incorrect input. Basically, you can implement an additional form that serves as a row editor for the values being input into the cell. Your validation logic should be implemented in this form. Then, when you want to edit a cell, this form will open in Dialog Mode and you will be able to close it only if the input is correct. 

You can learn more about Custom Row Editors here: Custom Row Editor for RadGridView. This approach could be used as a base for your custom validation form.

I hope this will help you. Do not hesitate to write back if you need further assistance.

Kind regards,
Deyan
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Armand
Top achievements
Rank 1
answered on 09 Jan 2009, 01:59 PM
Great. I will do it and give feedback on the result. It has been driving me crazy. Thank you.
Armand
Tags
GridView
Asked by
Armand
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Armand
Top achievements
Rank 1
Share this question
or