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

New Row add programtically in Edit Mode

1 Answer 235 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Muhammad Saad
Top achievements
Rank 1
Muhammad Saad asked on 24 Dec 2008, 03:48 PM
I am using WinForm 2008 Q1 control of Grid View.

I am developing a Point of Sale Application and there i used this grid on Sales screen. Now i want that when my Form is loaded My first cell should be in edit mode and as BarCode reads the Code it will Automatically enter and Add new row also in edit mode.

Now i used the CellEndEdit event and Successfully add the New Row.

Problem:
                First time form load i must need to click on the Row to set cell in edit mode.
                I was unable to make a newly added row in editable mode.
                if i add a row in CellEndEdit then also my Cursor not Moved to Next row.

Solution Needed:
                Any solution for add a new row and its first cell have the Cursor as a editable mode.

1 Answer, 1 is accepted

Sort by
0
Jordan
Telerik team
answered on 29 Dec 2008, 03:28 PM
Hi Muhammad Saad,

In order to have the first cell of the add new row of RadGridView in edit mode when the form is shown you have to focus the cell and call the BeginEdit method of RadGridView after all initialization code for the form (for example at the end of the OnLoad override) like bellow:
protected override void OnLoad(EventArgs e) 
        { 
            base.OnLoad(e); 
 
            //other initialization code here 
 
            this.radGridView1.CurrentColumn = this.radGridView1.Columns[0]; 
            this.radGridView1.CurrentRow = this.radGridView1.MasterGridViewInfo.TableAddNewRow; 
            this.radGridView1.PerformLayout(); 
            this.radGridView1.BeginEdit(); 
        } 

This code should be at the end because if some other code updates the layout of RadGridView after the call to BeginEdit the editor will most likely be closed.

Hope this helps.
Do not hesitate to write if you have more questions.

All the best,
Jordan
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
GridView
Asked by
Muhammad Saad
Top achievements
Rank 1
Answers by
Jordan
Telerik team
Share this question
or