Cities is linked to the country grids selected item.
Now if I select a country it display it's cities.
And I can add a city using "Click here to add new item"
However if the user doesn't select a country or there are no countries loaded then I can still add a row to cities.
I know how to intercept the cities "AddingNewDataItem"
Is there any way to determine if the cities is linked to a valid country.
Thanks
Jim
5 Answers, 1 is accepted
If I have understood you right, the DataContext of the Cities GridView is the Country's GridView SelectedItem.
If this is the case, then when the "AddingNewDataItem" event is raised, you could check if the DataContext of the Cities GridView is a valid one.
I hope that this helps.
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
The country/city are within this object.
So with country selected or country not selected the data context is always the same within the cities "AddingNewDataItem"
Jim
When this event is fired, what is the value of the "e.OwnerGridViewItemsControl.ParentRow" ('e' is the GridViewAddingNewEventArgs)?
Regards,Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
1) When the grids parent is empty or not selected it's nothing
2) When the grids parent has a selected row it's still nothing.
After 2) if I select anothe parent row and then reselect the original row the child row re-appears, So 2) works Ok
Jim
Would you please share how have you implemented the Master/Child relation?
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>