Dear Telerik forum :)
I have a parent-child relation between two business objects (defined in Linq to SQL):
- Parent: TransactionAccount
- Child: Transaction
I want to show all transactions in a grid. Each transaction shall have a combobox displaying all available transactions. I also want to use the built in grouping and sorting functionality. After a bit of struggling with different options I came up with the following solution.
This seems to work fine but in some particular cases (that I just cannot put my finger on) the parent Name is changed. So if I have two accounts Account1 and Account2, suddenly both have the same name.
ISSUE 1: So my question is: is this really the right approach? If so why does the binding update a property on my BO? I have tried every possible way to prevent that (IsEditable, IsReadOnly etc).
ISSUE 2: Another issue is that when I have the combo open on the last row and press Enter the focus goes "somewhere else" and the only way to resume navigation with the keyboard is to click on the application.
Thanks for any input!
I have a parent-child relation between two business objects (defined in Linq to SQL):
- Parent: TransactionAccount
- Child: Transaction
I want to show all transactions in a grid. Each transaction shall have a combobox displaying all available transactions. I also want to use the built in grouping and sorting functionality. After a bit of struggling with different options I came up with the following solution.
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding TransactionAccount.Name, Mode=OneWay}"
Header
=
"AccountName"
>
<
telerik:GridViewDataColumn.CellEditTemplate
>
<
DataTemplate
>
<
ComboBox
DataContext
=
"{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=telerik:RadGridView}, Path=DataContext}"
DisplayMemberPath
=
"Name"
IsEditable
=
"False"
IsReadOnly
=
"True"
ItemsSource
=
"{Binding TransactionAccounts}"
SelectedItem
=
"{Binding CurrentTransaction.TransactionAccount, Mode=TwoWay}"
/>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellEditTemplate
>
<
telerik:GridViewDataColumn.AggregateFunctions
>
<
Data:CountFunction
Caption
=
"Count: "
/>
</
telerik:GridViewDataColumn.AggregateFunctions
>
</
telerik:GridViewDataColumn
>
This seems to work fine but in some particular cases (that I just cannot put my finger on) the parent Name is changed. So if I have two accounts Account1 and Account2, suddenly both have the same name.
ISSUE 1: So my question is: is this really the right approach? If so why does the binding update a property on my BO? I have tried every possible way to prevent that (IsEditable, IsReadOnly etc).
ISSUE 2: Another issue is that when I have the combo open on the last row and press Enter the focus goes "somewhere else" and the only way to resume navigation with the keyboard is to click on the application.
Thanks for any input!