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

NewRow Using DOWN Arrow

1 Answer 30 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tooraj
Top achievements
Rank 1
Tooraj asked on 20 Apr 2011, 06:39 AM
Hi,
1. I want to add  a new row by preesing the DOWN Arrow and Insert a new row at current position using "+" key in my grid.
2. How can I know it that at which row Dupplicate key is inserted? Afetr detect I want to move cursor to that row. Also I want to set the row's ErrorText to my own Message.Please help me.

Further questions are coming soon, Thank you,
Tooraj Azizi.

1 Answer, 1 is accepted

Sort by
0
Martin Vasilev
Telerik team
answered on 22 Apr 2011, 11:39 AM
Hello Tooraj,

Thank you for writing.

I am afraid we do not support adding a new row through key press events out of the box. However, you can implement this yourself by using a custom grid behavior. Please consider the following code as an example:
private void Form1_Load(object sender, EventArgs e)
{
    this.radGridView1.GridBehavior = new CustomGridBehavior();
}
 public class CustomGridBehavior : BaseGridBehavior
    {
        public override bool ProcessKeyDown(KeyEventArgs keys)
        {
            if (keys.KeyCode == Keys.Down)
            {
                GridViewRowInfo newRow = this.GridControl.Rows.AddNew();
                this.GridControl.CurrentRow = newRow;
                return true;
            }
            return base.ProcessKeyDown(keys);
        }
    }

As to your second question, probably you would like to implement a validation scenario. You can do that through one of the provided validation events. For more details, please refer to our product documentation.

I hope this helps. Let me know if you have any additional questions.

Kind regards,
Martin Vasilev
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
Tooraj
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Share this question
or