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

Switch current editing cell

1 Answer 75 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Phil
Top achievements
Rank 1
Phil asked on 16 Apr 2009, 08:07 PM

Hello, I'm trying to switch cell is being edited based on selection in the current cell.
the current cell is a combobox column, if a paticular selection is made I'd like to put another cell in the same row into edit mode.
The code below seems to do that, however the selected value of the first cell is not persisted.
I'm assuming that's because the edit sequence did not complete for the initial cell.
Is there a better way to do this?

If TypeOf sender Is Telerik.WinControls.UI.GridComboBoxCellElement Then 
            cell = RadGridView1.CurrentView.CurrentCell  
 
            If RadGridView1.ActiveEditor.Value.ToString().ToLower() = "customexpression" Then 
 
                ex_cell = cell.RowInfo.Cells("Expression")  
                ex_cell.BeginEdit()  
 
            End If 
        End If 

Thanks

1 Answer, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 17 Apr 2009, 04:08 PM
Hello Phil,

Thank you for contacting us. There is no out-of-the-box solution for this so I have tried to find a work-around. Please review the code below:

 private void radGridView1_ValueChanged(object sender, EventArgs e) 
        { 
            if (this.radGridView1.CurrentCell.ColumnIndex == 1) { 
                this.radGridView1.CurrentColumn = this.radGridView1.Columns[0]; 
                this.radGridView1.CurrentRow = this.radGridView1.Rows[this.radGridView1.CurrentCell.RowIndex]; 
                this.radGridView1.BeginEdit(); 
            } 
        } 

You may use ValueChanged event to see which column has been changed and base on that make a cell in the same row current and then invoke BeginEdit. I hope this helps. Do not hesitate to write me back if you have more questions.

All the best,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Phil
Top achievements
Rank 1
Answers by
Nick
Telerik team
Share this question
or