GridView / Form sync at child level

3 posts, 0 answers
  1. Mark
    Mark avatar
    155 posts
    Member since:
    Oct 2010

    Posted 13 Jun 2011 Link to this post

    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. Mark
    Mark avatar
    155 posts
    Member since:
    Oct 2010

    Posted 15 Jun 2011 Link to this post

    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.
  3. DevCraft banner
  4. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 16 Jun 2011 Link to this post

    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
Back to Top