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

Commit edit from details view

6 Answers 342 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tommaso
Top achievements
Rank 1
Tommaso asked on 18 Aug 2010, 08:48 AM
We would like to have "advanced editing" for some cells in the details view: some cells in a row are simple to edit (strings, integers), others are quite complex and using a custom data template with lots of controls make the grid very cumbersome to use and un-pleasant to see.
Anyway, we have bound the data succesfully, but we would like to avoid automatic "commit" of the edit until the user wants to do so (pressing "Enter", clicking a button...)
We tried with a button; in the event handler for click we inserted the line
private void btnSave_Click(object sender, RoutedEventArgs e)
      {
         this.RadGridView1.CommitEdit();        
      }
But to no avail: the selected row grid remains in edit mode, changes are not saved

Which is the correct way to do so?
Thanks,
Lorenzo

6 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 18 Aug 2010, 09:18 AM
Hello Lorenzo Dematte',

You may try to use the CellEditEnded and RowEditEnded events of the RadGridView. More information about the Updating an Entry can be found in our online documentation. Furthermore, in case it could be of any help for your scenario, you may take a look at our online example for different types of Edit Templates.

All the best,
Maya
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
Tommaso
Top achievements
Rank 1
answered on 18 Aug 2010, 09:42 AM
Hello Maya,
Thank you for the reply.
Actually, I would like to do "the other way around": I don't need to be notified of when an edit starts or ends, but I want to trigger the end of the edit. I thought "CommitEdit" was the right thing to do, but it's not working (the grid row remains in edit mode, with the editable textboxes and so on). Maybe is it because the CommitEdit is called from within the row? (The button is in the DetailsView of the current row in edit mode).

Cheers,
Lorenzo
0
Accepted
Maya
Telerik team
answered on 18 Aug 2010, 01:42 PM
Hi Lorenzo Dematte',

I have prepared a sample project following the requirements of editing with RowDetails and submitting the changes with a button click. 
In case that it does not meet your exact requirements, please share more details about your application and its settings. It would be great if you could send us a sample project illustrating the main idea of it.
 

All the best,
Maya
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
Tommaso
Top achievements
Rank 1
answered on 18 Aug 2010, 02:13 PM
That's exactly what I needed, thank you!
Lorenzo
0
Michael Luna
Top achievements
Rank 1
answered on 07 Jan 2011, 08:50 AM
Could I get an updated verision of this example?  can not load it

Error 1 Could not load file or assembly 'Telerik.Windows.Controls, Version=2010.2.714.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) C:\devwork\Telerik datagrid\EditWithRowDetails_COmmitEdit\MainWindow.xaml 1 1 EditWithRowDetails_COmmitEdit
0
Maya
Telerik team
answered on 07 Jan 2011, 09:13 AM
Hello Michael,

I have updated the sample so that it uses the binaries from our current official release Q3 2010. I hope you will not have troubles running the project now. Still, you may take a look at the code -  MainWindow.xaml and MainWindow.xaml.cs and use the most important par of it - the definition of the RowDetailsTemplate and the way the Click event of the RadButton is handled.

Best wishes,
Maya
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
Tags
GridView
Asked by
Tommaso
Top achievements
Rank 1
Answers by
Maya
Telerik team
Tommaso
Top achievements
Rank 1
Michael Luna
Top achievements
Rank 1
Share this question
or