Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
155
WHDG - Commiting childgrid batch-updates
posted

Hello, I'm having a big problem here. I'm using a WHDG with a WebHierarchicalDataSource connected to 2 SQLDataSources for editing a master-Detail view.

This is how my grid is defined:

<ig:WebHierarchicalDataGrid ID="WebHierarchicalDataGrid1" ClientIDMode="Static" Width="100%" runat="server" AutoGenerateColumns="False" ValidateRequestMode="Disabled" AutoGenerateBands="False" DataKeyFields="ID" DataMember="SqlDataSource1_DefaultView" DataSourceID="WebHierarchicalDataSource1" Key="SqlDataSource1_DefaultView" OnRowUpdating="WebDataGrid1_RowUpdating" >

<Bands>
   
<ig:Band AutoGenerateColumns="False" DataMember="SqlDataSource2_DefaultView" Key="SqlDataSource2_DefaultView" DataKeyFields="ID, CHILD_ID" OnRowUpdating="WebDataGrid1_RowUpdating">
       
<Columns>
            
<ig:BoundDataField DataFieldName="ID" Key="ID" Hidden="true">
                
<Header Text="ID">Header>
            
ig:BoundDataField>

             <ig:BoundDataField DataFieldName="CHILD_ID" Key="CHILD_ID">
                
<Header Text="CHILD_ID">Header>
            
ig:BoundDataField>

        Columns>
   
ig:Band>

Bands>

<Columns>

<ig:BoundDataField DataFieldName="ID" Key="ID" Hidden="true">

<Header Text="ID">

Header>

ig:BoundDataField>

<ig:BoundDataField DataFieldName="DESCRIPTION" Key="DESCRIPTION">

<Header Text="DESCRIPTION">

Header>

ig:BoundDataField>

Columns>

<Behaviors>

<ig:EditingCore AutoCRUD="False" BatchUpdating="True" EnableInheritance="true">

<Behaviors>

<ig:RowEditing EnableInheritance="true">

ig:RowEditing >

<ig:RowDeleting EnableInheritance="true">

ig:RowDeleting>

<ig:RowAdding EnableInheritance="true">

ig:RowAdding>

Behaviors>

ig:EditingCore>

Behaviors>

ig:WebHierarchicalDataGrid>

Then I'm calling the following JavaScript function when clicking on a Save-Button:

function commitWHDGrid() {

     var editingCore = $find("WebHierarchicalDataGrid1").get_gridView().get_behaviors().get_editingCore();

          NProgress.start();

     $find("WebHierarchicalDataGrid1").get_gridView().get_behaviors().get_editingCore().commit();

     return false;

}

When I edit a row in the Master-View (the main grid), and then click the button, my RowUpdating method is being called. When I on the other Hand, update one of the child grid rows and press the button, the onRowUpdating Event is not being called.

What am I doing wrong?

For the sake of completeness:

protected void WebDataGrid1_RowUpdating(object sender, Infragistics.Web.UI.GridControls.RowUpdatingEventArgs e)

{

     ContainerGrid grid = ((ContainerGrid)sender);

     if (grid.Level == 0)

          {

                 // update in main grid occured

             SqlDataSource1.UpdateParameters["ID"].DefaultValue = e.OldValues["ID"].ToString();

             .....

     }else{

        // update in child grid occured

             SqlDataSource2.UpdateParameters["ID"].DefaultValue = e.OldValues["ID"].ToString();

     }

     WebHierarchicalDataGrid1.Rows.Clear();

     WebHierarchicalDataGrid1.DataBind();

     WebHierarchicalDataGrid1.GridView.RequestFullAsyncRender();

}