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

GridView / Form sync at child level

2 Answers 85 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 13 Jun 2011, 07:56 PM
Hi All,

This is a bit trivial but I'm just not getting it, my apologies...

I have a Dds returning a parent / child fine using .Include.
Three controls on the child window page for editing .. a listbox, GridView and DataForm.

Listbox is bound to the parent.
GridView is bound to the child like Dds.DataView.tblChild.

As selections are changed on the listbox the DataGrid keeps sync, no issues there.

I'm trying to use the dataform to edit the selected row in the DataGrid but can't seem to get the binding correct.

I'm tried Dataform.CurrentItem = datagrid.SelectedItem & various ItemSource bindings (tried the Dds, tried element binding to datagrid.itemssource).

I just can't get the dataform to sync to the grid selection changes.  (I'm using the toolkit, not telerik at the moment because of themes).

Any suggestions would be appreciated.

Thanks as always,
Mark

Here is a little code if that helps for understanding:

dg_children.SetBinding(RadGridView.ItemsSourceProperty, new Binding("DataView.tblVarietals") { Source = OriginDds });
  
  
                        GridViewDataColumn colVar = new GridViewDataColumn();
                        colVar.Header = "Varietal";
                        colVar.DataMemberBinding = new Binding("varietalName");
                        colVar.IsReadOnly = true;
                        colVar.Width = new GridViewLength(1, GridViewLengthUnitType.Star);
                        colVar.UniqueName = "Varietal";
  
                        dg_children.Columns.Add(colVar);
  
                        gridSet = true;
  
                          
                        df_child.EditTemplate = this.Resources["VarietalDataTemplate"] as DataTemplate;
                        df_child.SetBinding(DataForm.ItemsSourceProperty, new Binding("DataView.tblVarietals") { Source = OriginDds });
                        
                        //This unfortunately does not work
                        //df_child.SetBinding(DataForm.CurrentItemProperty, new Binding("SelectedItem") {Source = dg_children});

2 Answers, 1 is accepted

Sort by
0
Mark
Top achievements
Rank 1
answered on 15 Jun 2011, 02:20 PM
At this point I've wrapped the dataform itemssource with a CVS and am filtering based on the selection in the GridView. If there is a better method please let me know.
0
Pavel Pavlov
Telerik team
answered on 16 Jun 2011, 09:41 AM
Hi Mark,

I think your approach is pretty much the same as the one demonstrated in in this online example.

And yes, I believe this is a good approach .

Kind regards,
Pavel Pavlov
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
DataForm
Asked by
Mark
Top achievements
Rank 1
Answers by
Mark
Top achievements
Rank 1
Pavel Pavlov
Telerik team
Share this question
or