This question is locked. New answers and comments are not allowed.
I have two unrelated questions about RadGridView control.
1. I have a grid with 'IsReadOnly', 'CanUserInsertRows' and 'ShowInsertRow' properties set to 'true'. This way user can add new record after clicking on "Click here to add new item" row. He can also edit every cell of every row simply by double-clicking on it. What I need is to block editing while allowing to insert. Editing should be only possible after selecting "Edit" from context menu, but not after double-click. My first idea was to set grid's 'IsReadOnly' property to false, which blocks double-click editing and set it to true when user selects "Edit" in menu. Problem is, setting 'IsReadOnly' to false disables the "Click here to add..." row, and I want user to be able to add new items with it. Is there a solution?
2. Second question regads "CellEditTemplate". I have a column:
When row is edited combobox appears from which user selects role. Questions is, when user ends editing how can I get the value he selected from combobox? There is an event, RowEditEnded, where I take new record and send it via WCF to server side, like this:
New 'User' object is however incomplete, as I don't know what role user selected. I cannot use binding in the same way as with other properties of User, because role is not just a string or int.
I woud be most grateful for any tips. Thanks.
1. I have a grid with 'IsReadOnly', 'CanUserInsertRows' and 'ShowInsertRow' properties set to 'true'. This way user can add new record after clicking on "Click here to add new item" row. He can also edit every cell of every row simply by double-clicking on it. What I need is to block editing while allowing to insert. Editing should be only possible after selecting "Edit" from context menu, but not after double-click. My first idea was to set grid's 'IsReadOnly' property to false, which blocks double-click editing and set it to true when user selects "Edit" in menu. Problem is, setting 'IsReadOnly' to false disables the "Click here to add..." row, and I want user to be able to add new items with it. Is there a solution?
2. Second question regads "CellEditTemplate". I have a column:
| <grid:GridViewDataColumn Header="Role" UniqueName="Role" DataMemberBinding="{Binding Role.Name}"> |
| <grid:GridViewDataColumn.CellEditTemplate> |
| <DataTemplate> |
| <input:RadComboBox x:Name="rcbRole" Loaded="rcbRole_Loaded" /> |
| </DataTemplate> |
| </grid:GridViewDataColumn.CellEditTemplate> |
| </grid:GridViewDataColumn> |
| private void RadGridView1_RowEditEnded(object sender, GridViewRowEditEndedEventArgs e) |
| { |
| if ( e.EditAction == GridViewEditAction.Cancel ) |
| return; |
| User user = (User)e.NewData; |
| if (e.EditOperationType == GridViewEditOperationType.Edit) |
| proxy.UpdateUserAsync(user); |
| else |
| proxy.InsertUserAsync(user); |
| } |
I woud be most grateful for any tips. Thanks.