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

[Solved] Telerik Grid cell Value after updating the cell

8 Answers 191 Views
Grid for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Puneeth
Top achievements
Rank 1
Puneeth asked on 12 Feb 2014, 01:18 PM
Hi,
 
I am editing the grid cell value by click on particular cell like (quantity column changing from 0 to 3)
I want to get the changed cell value.
Please suggest or help me out to get the solution

Thanks
Puneeth

8 Answers, 1 is accepted

Sort by
0
Rosy Topchiyska
Telerik team
answered on 17 Feb 2014, 10:34 AM

Hello Puneeth,

Thank you for contacting us.

In this scenario you can take advantage of the ValidateCell DataGridCommand. This command is executed when a grid cell value is changed. Through the CellInfo property of the received parameter (which is of type ValidateCellContext) you can get the column, the cell value and the data item.
Unfortunately, at the moment the command is executed, the context hasn't updated its Value which is a Windows 8.1 related issue. As a workaround, you can get the updated cell Value in a Dispatcher.RunAsync() call with Low CoreDispatcherPriority. I have attached a sample project that demonstrates how to do that.

Let me know if this works for you.

Regards,
Rositsa Topchiyska
Telerik
 

Check out the new Telerik Platform - the only modular platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native apps. Register for the free online keynote and webinar to learn more about the Platform on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT).

 
0
Randall
Top achievements
Rank 1
answered on 24 Apr 2014, 05:59 AM
Hello Rosy,
This is the same kind of issue I have.  I want to click on a certain cell and change the value from 'In progress' to 'Completed.  In your post, you mentioned a sample project enclosed but I don't see that sample project to download.  Could you show me where to get that sample project or reattach it to the post.

Thank you,
Dennis
0
Rosy Topchiyska
Telerik team
answered on 24 Apr 2014, 11:17 AM
Hello Randall,

Thank you for writing.

For some reason the attachment was not visible in the public forum. I have reattached the project to my previous answer and it is now available for download.

Please, let us know if you have any other questions.

Regards,
Rosy Topchiyska
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Randall
Top achievements
Rank 1
answered on 24 Apr 2014, 11:06 PM
Hello again and thank you for your quick response.  I understand how the sample works. As I click the up or down arrows the cell adds or subtracts a number.  However, I want to be able to have the user tap on an arrow and have them choose a value of three 'string' choices. "In Progress", "Completed", or "N/A".  Is there a way to set these three string values instead of numeric values?

Thanks again
0
Rosy Topchiyska
Telerik team
answered on 28 Apr 2014, 08:51 AM
Hi Randal,

Thank you for the question.

The editing UI is available only for the typed data grid columns (all types of columns except for the DataGridTemplateColumn). Unfortunately none of the typed columns could be used for your scenario. The editing UI for DataGridNumericalColumn uses a RadNumericBox, which works only with numbers. In your case you can use DataGridTemplateColumn with for example ComboBox as template. Since the editing makes no sense for template column, the use of commands is not applicable. You can use the SelectionChanged event of the ComboBox or listen for property changed of the data item instead. I have attached a sample project that demonstrates how to create a column with ComboBox.

I hope this will give you some ideas. Please, let us know if you have further questions.

Regards,
Rosy Topchiyska
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Randall
Top achievements
Rank 1
answered on 30 Apr 2014, 06:40 AM
Thank  you Rosy for your help and supplying the ComboBox sample.  I can get it to work but somewhere I'm missing a key ingredient.  When my ViewModel loads the data in an ObservableCollection, I have a column called ECL_Status that has existing data that needs to load with the rest of the other data columns.  I'm not sure how to Bind the data that is loading into the datagrid to be included in the ComboBox Status Column.  Presently, the Status column in your sample is just loading the three enums (N/A, Completed, In Progress).  I need to load existing data at the same time as adding the enums to each row.  So when the grid is finally displayed, I want my existing data to be selected for each row in the Status Column as well as the ComboBox selection for each row Status Column cells. Below is the code for my RadGrid and my ViewModel, and I am also attaching a screenshot of the present final results.
In the attached code, I use a column named ECL_Status for the existing data that I want to add my ComboBox selected value.  As you can see by the screenshot, it's only loading the three Enums in every row and it's supposed to the current values in the existing data with the option to change the values with one of the Enums.

I hope this makes sense to you.

*** I added a '.png' to the extension of the text file to upload to you.  Just delete the '.png' extension off the end to open the text file.  


Thanks again
0
Rosy Topchiyska
Telerik team
answered on 30 Apr 2014, 05:41 PM
Hi Randall,

Thank you for contacting us.

I can see that you have used a property called Status in the ComboBox SelectedItem binding, but in your Data class you have ECL_Status property.

I hope this helps. Please, let us know if you have further questions.

Regards,
Rosy Topchiyska
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Randall
Top achievements
Rank 1
answered on 02 May 2014, 06:47 AM
Thank you Rosy, I figured it out and it works great!  What I had to do is convert my string value from the database into an enum and it all worked out.

Thanks again
Tags
Grid for XAML
Asked by
Puneeth
Top achievements
Rank 1
Answers by
Rosy Topchiyska
Telerik team
Randall
Top achievements
Rank 1
Share this question
or