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

User clicks on ESCAPRE on New Row

6 Answers 37 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ravi
Top achievements
Rank 1
Ravi asked on 17 May 2011, 12:48 PM
Hi,

I have implemented the New row on my hierarchical grid. it works perfect. however when the user clicks on the new row, and new appears and when the user press Escape ONCE, the row edit mode is reverted but still the row still remains. If the user again press Escape the row disappears.

My requirement is, If its a new Row, if the user press once escape button, even if it had data or not, the new row should disappear and the grid should come to normal state.

Please advice.

6 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 17 May 2011, 02:53 PM
Hi David,

Would you please, share with us what kind of data source you are using to populate your RadGridView?

Kind regards,
Ivan Ivanov
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
Ravi
Top achievements
Rank 1
answered on 17 May 2011, 02:57 PM
I have model class. I populate the data into the model class and then assign the data to the datagrid by the ItemSource property.
0
Ivan Ivanov
Telerik team
answered on 17 May 2011, 03:02 PM
Hi David,

What type of collection have you assigned to the ItemsSource property?

Kind regards,
Ivan Ivanov
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
Ravi
Top achievements
Rank 1
answered on 17 May 2011, 03:03 PM
List<myClass>
0
Ivan Ivanov
Telerik team
answered on 17 May 2011, 03:26 PM
Hi David,

You may try utilizing this approach:
public MainPage()
{
    InitializeComponent();
    clubsGrid.CellEditEnded += new EventHandler<GridViewCellEditEndedEventArgs>(clubsGrid_CellEditEnded);
}
void clubsGrid_CellEditEnded(object sender, GridViewCellEditEndedEventArgs e)
{
    if (clubsGrid.ChildrenOfType<GridViewNewRow>().First().IsInEditMode)
        clubsGrid.ChildrenOfType<GridViewNewRow>().First().CancelEdit();
}

Please, inform us if this solution meets your requirements.

Kind regards,
Ivan Ivanov
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
Ravi
Top achievements
Rank 1
answered on 18 May 2011, 03:25 AM
Hi,

Thanks for your valuable suggestion.

I tried the below code and its working.

else if (key == Key.Escape)
           {
               commandsToExecute.Add(RadGridViewCommands.CancelRowEdit);
           }

Inheriting from
DefaultKeyboardCommandProvider

Thanks,
Tags
GridView
Asked by
Ravi
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Ravi
Top achievements
Rank 1
Share this question
or