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

RowValidating

1 Answer 184 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mihai Velicu
Top achievements
Rank 1
Mihai Velicu asked on 07 Apr 2010, 06:59 PM
Hi !

I have a grid with 3 columns, one string, one string and one boolean.

I validate the new row with RowValidating. Work very nice .I put some code if the string columns are empty E.cancel = true .If all the fields are empty even if I press enter or tab the empty row is not added to already existent rows in grid. Nice.
BUT
If I add DefaultValuesNeeded event and I give to the boolean column a value of true, the behaviour of RowValidating is changing.Now If I press enter in any string columns , the row is added to the existent rows in grid, of course with the string values empty,and is not what I expected.

Can someone explain me how to avoid this ?

Regards,
Mihai


1 Answer, 1 is accepted

Sort by
0
Accepted
Jack
Telerik team
answered on 12 Apr 2010, 02:36 PM
Hello Mihai Velicu.
 
Thank you for reporting this issue. I confirm that it appears in our latest release and I added it in our bug tracking system. It will be addressed in one of our upcoming releases. I have updated also your Telerik points accordingly.

You can work around the issue by using custom grid behavior. Please consider the code below:

this.radGridView1.GridBehavior = new MyGridBehavior();
 
class MyGridBehavior : BaseGridBehavior
{
    public override bool ProcessKeyDown(KeyEventArgs keys)
    {
        if (GridControl.CurrentRow is GridViewNewRowInfo && GridControl.IsInEditMode)
        {
            if (keys.KeyCode == Keys.Down || keys.KeyCode == Keys.Enter)
            {
                GridControl.CancelEdit();
                return true;
            }
        }
        return base.ProcessKeyDown(keys);
    }
}

Kind regards,
Jack
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
Mihai Velicu
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or