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();

}

Parents
No Data
Reply
  • 8421
    posted

    Hello Marc,

    Most likely the issue is that you are clearing the rows and rebinding the grid in your RowUpdating event. Is there any reason that you have this logic placed here? Other than that, another issue I see is that the only fields you appear to have in your child grid are part of the DataKeyFields setting, which means these are used as the primary key and should not be allowed to change. Do you have additional columns that you are allowing editing on or is it just the one visible ChildID column? Is this required to be specified as part of the DataKeyFields?

    Other than this, updating logic should work without issue for the children and the parents. Is there a specific build of the Infragistics for ASP.NET controls that causes this issue?

Children