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

Edit Mode

4 Answers 241 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Zerka
Top achievements
Rank 1
Zerka asked on 13 Jan 2011, 09:22 AM
Hi,

I need this functionality in my application that when user is in edit mode in a cell and then leaves the cell, then next selected cell should not be in edit mode. Means leaving an editable cell should bring the grid out of editable mode no matter user leaves the editable cell by pressing right or left key or by using mouse . Can anyone help about it? Any help would be appreciated.

Thanks

4 Answers, 1 is accepted

Sort by
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 13 Jan 2011, 10:00 AM
Hello Michael,

Just use the CellValidating or CellValidated event to call EndEdit() on the CurrentCellInfo,like so:
void radGridView1_CellValidating(object sender, CellValidatingEventArgs e)
{
    if (radGridView1.CurrentRow != null && radGridView1.CurrentCell != null)
    {
        radGridView1.CurrentRow.Cells[radGridView1.CurrentCell.ColumnIndex].EndEdit();
    }
}

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga
Telerik WinForms MVP
0
Zerka
Top achievements
Rank 1
answered on 13 Jan 2011, 10:38 AM
Thanks!

Regards
0
Zerka
Top achievements
Rank 1
answered on 13 Jan 2011, 10:44 AM
Hi Emanuel

Thanks for your help. Yesterday I posted a question but did not get answer about that yet. May be you can help me about that too.

I am using RadGridView. In cell edit mode of a decimal column, I do not want the incerement and decrement in cell value. So I set the Step property of the column to 0. It is working. I want that in cell edit mode when user presses up and down key, it commits the cell value and cursor moves to up and down cell accordingly. How can I acheive this. Any Help would be appreciated!

Best Regards!
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 13 Jan 2011, 11:01 AM
Hello again,

I was just looking into your other problem, when i saw your reply, please take a look at that thread, hope it fit your requirements.

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga
Telerik WinForms MVP
Tags
GridView
Asked by
Zerka
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Zerka
Top achievements
Rank 1
Share this question
or