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

Select New Row

6 Answers 322 Views
GridView
This is a migrated thread and some comments may be shown as answers.
wima
Top achievements
Rank 1
wima asked on 17 Feb 2010, 09:31 AM
Hello

How can I realize this behavior? The user clicks to the first cell of the new row at the top of the grid. He fills in a value, then he presses the tab key. The cursor goes through the cells. When the user presses tab in the last cell, the row should be added and the cursor should go to the first cell of a new row.
This does not work for me: http://www.telerik.com/community/forums/winforms/gridview/automatically-add-new-row.aspx

Thank you
wima

6 Answers, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 18 Feb 2010, 12:29 PM
Hi wima,

Thank you for contacting us. There will be a new property that will make that possible in the new RadGridView to be released at the beginning of March. Please excuse us for the inconvenience. I have updated your Telerik points.

Best wishes,
Nick
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.
0
moh salhi
Top achievements
Rank 1
answered on 14 Apr 2010, 10:54 PM
Hi ,
I need to ask 2 question about grid.
1) I need to make the first cell in new row in editable mode from code, without user used mouse to click on grid , can you help me ?
2) i have rad version 2010 Q1 , but the cursur not go to the first cell in new row when i end from last cell< can you help me how to do this in code ?

Thank you
salhi
0
Jack
Telerik team
answered on 15 Apr 2010, 09:38 AM
Hi moh salhi, thank you for contacting us.

Regarding your questions:

1. You should mark the new row and the first column as current, then you need to call the BeginEdit method. Here is a sample:

protected override void OnShown(EventArgs e)
{
    base.OnShown(e);
 
    this.radGridView1.MasterGridViewInfo.TableAddNewRow.IsCurrent = true;
    this.radGridView1.Columns[0].IsCurrent = true;
    this.radGridView1.BeginEdit();
}

2. I am not sure that I understand you question, however you could use the code from the code snippet above to make the first column current. 

I hope this helps.

 

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.
0
moh salhi
Top achievements
Rank 1
answered on 19 Apr 2010, 04:07 PM
thanks Jack

yes this is work good.

I need to ask about new row,
 i work with gride , and i need to set the some value in new row when user leave the cell>
example :
user add new row
in cell(0) user enter ( 1 )  ' Emp No.
in cellendedit event i need to write code to set value in cell(1) ' Emp Name

can you help me please
0
Jack
Telerik team
answered on 20 Apr 2010, 04:57 PM
Hi moh salhi,

We will ask you to please open new forum threads on each new question, especially when they are not related to your previous ones. This way other users will not get confused when reading the Forums.

You can do this by setting the cell Value property. Here is a sample:

void radGridView1_CellEndEdit(object sender, GridViewCellEventArgs e)
{
    if (this.radGridView1.CurrentRow is GridViewNewRowInfo &&
        ((GridViewDataColumn)this.radGridView1.CurrentColumn).UniqueName == "ID")
    {
        if (this.radGridView1.CurrentRow.Cells["Name"].Value == null ||
            this.radGridView1.CurrentRow.Cells["Name"].Value == DBNull.Value)
        {
            this.radGridView1.CurrentRow.Cells["Name"].Value = "John";
        }
    }
}

You can use also the DefaultValuesNeeded event, which fires when entering the add new row:

void radGridView1_DefaultValuesNeeded(object sender, GridViewRowEventArgs e)
{
    e.Row.Cells["Name"].Value = "John";
}

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.
0
Victoria F
Top achievements
Rank 1
answered on 20 Oct 2010, 07:18 PM



Tags
GridView
Asked by
wima
Top achievements
Rank 1
Answers by
Nick
Telerik team
moh salhi
Top achievements
Rank 1
Jack
Telerik team
Victoria F
Top achievements
Rank 1
Share this question
or