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

Updating a column when another column changes

1 Answer 50 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Terry
Top achievements
Rank 1
Terry asked on 16 Jul 2010, 05:46 AM
Hi:

I have a RadDatePicker in a CellEditTemplate.  When the date is changed, I need to change the contents of another column in the row.

How do I determine the row, so I can get its underlying object in the RadDatePicker_SelectionChanged event?  Or is there another way I should do it?

Thanks,

Terry

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 20 Jul 2010, 03:14 PM
Hi Terry,

If you define a regular GridViewDataColumn and bind it to a Property of type DataTime, it will automatically provide you with a DatePicker when editing the values. 
However, in case you need to use CellEditTemplate and set a RadDatePicker as its DataTemplate, you may consider working with the CellEditEnded event instead. Serving your requirements, you may define it as follows:

private void playersGrid_CellEditEnded(object sender, GridViewCellEditEndedEventArgs e)
        {
            if (e.Cell.Column.UniqueName == "Birthday")
            {
                Player myPlayer = e.Cell.ParentRow.Item as Player;
                myPlayer.Country = "Bulgaria";
            }          
        }

I hope that helps.
 

Sincerely yours,
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
Tags
GridView
Asked by
Terry
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or