Welcome to the Xceed Community Sign in | Join | Help
Community Search  

Insertion Row on Details in Master Detail Grid

Sort Posts: Previous Next
  •  04-29-2008, 3:09 PM Post no. 11842

    Insertion Row on Details in Master Detail Grid

    Hi

    I've looked through many many posts on this forum but I'm not getting the answer I'm looking for. (I suspect I'm missing something obvious)

    I've got a Master Detail grid bound to Linq Bindinglists. When a row is inserted to the grid, I want to manualy write the row data back to our system via a web service call. I'm successfully doing this on the master section, by overriding the InsertionRow OnEndingEdit event, and then simply taking the last element in the Master BindingList as the item I need to write back to our system. This might not be the most elegant, but it works.

     On the insertion row in the details section I have a problem: I can no longer just take the last item in the bindinglist. I need to find the item that was added, and I also need to know to which item from the master section grid it was added. I don't see an easy way to find a reference to the item that was just added  (or the item that will be added depending on which event you handle).

    Jenny, from your other posts it seems like the loaded event on the InsertionRow might be of use, but I don't see how? I don't see how a reference to the InsertionRow itself or the parent grid will help?

    Thanks! 

     

     

    Filed under: ,
  •  04-30-2008, 9:10 AM Post no. 11864 in reply to 11842

    Re: Insertion Row on Details in Master Detail Grid

    Hi Henry,

    The InsertionRow's DataContext is the System.Data.DataRow (assuming you are using DataTables, otherwise use whatever the type of your data item is). Therefore, you could handle the DetailConfiguration.InitializingInsertionRow event and get the data item there. Something like this:

    <xcdg:DataGridControl.DetailConfigurations>
      
    <xcdg:DetailConfiguration InitializingInsertionRow="OnInitializingInsertionRow"
                                            
    RelationName="Employee_Orders">
         
    <xcdg:DetailConfiguration.Headers>
            
    <DataTemplate>
               
    <xcdg:InsertionRow />
            
    </DataTemplate>
         
    </xcdg:DetailConfiguration.Headers>
      
    </xcdg:DetailConfiguration>
    </xcdg:DataGridControl.DetailConfigurations>

    private void OnInitializingInsertionRow( object sender, InitializingInsertionRowEventArgs e )
    {
       System.Data.
    DataRow row = e.InsertionRow.DataContext as System.Data.DataRow;
    }


    Technical Writer - Xceed Software

    Of all the things I've lost, I miss my mind the most. - Mark Twain
    Filed under:
  •  05-04-2008, 4:08 PM Post no. 11952 in reply to 11864

    Re: Insertion Row on Details in Master Detail Grid

    Hi Jenny

    Again you save me from certain insanity!

    That works. Thank you very much.

    Henry

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.