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
40
RowUpdating event from child band when AutoCRUD=false
posted

I have created a WebHierarchicalDataGrid which has a parent band and a single child band, description of which is below. I'm unable to get my WebHierarchicalDataGrid to fire the RowUpdating event when a row is updated in the child band. Any help would be greatly appreciated! I am using version 2010.1

I've tried a couple of different methods that I have found from these forums, one being to add an event handler to the band during the form1_Init sub on the server-side (as shown below). Another method was to forward processing to a Javascript function by adding <CellEditingClientEvents ExitedEditMode="GridRowUpdate"/> -

        function GridRowUpdate()
        {
            var grid = $find("WebHierarchicalDataGridTS");
            grid.get_gridView().get_behaviors().get_editingCore().commit();
        }

The method above returns a JS error on the commit() line (null) - I guess I need to fire a commit() from the child band instead, not sure how to do this?. The method below simply does not fire the events (at least they are not picked up by the server-side functions.

 

<ig:WebHierarchicalDataGrid ID="WebHierarchicalDataGrid1" runat="server" AutoGenerateColumns="False"
    DataKeyFields="ID" Height="400px" Key="MyFirstTable" Width="850px" AutoGenerateBands="False" EnableViewState="False"
    EnableDataViewState="True" >
    <GroupingSettings>
        <RemoveButton AltText="Ungroup Column" />
    </GroupingSettings>
    <Columns>
        <ig:BoundDataField DataFieldName="ID" Key="ID" VisibleIndex="0" Hidden="True">
            <Header Text="ID" />
        </ig:BoundDataField>
        <ig:BoundDataField DataFieldName="Name" DataType="System.String" Key="Name" VisibleIndex="1">
            <Header Text="Name" />
        </ig:BoundDataField>
    </Columns>
    <CollapseButton AltText="Collapse Row" />
    <ExpandButton AltText="Expand Row" />
    <Bands>
        <ig:Band AutoGenerateColumns="False" Key="Days" DataMember="MySecondTable">
            <ExpandButton AltText="Expand Row" />
            <CollapseButton AltText="Collapse Row" />
            <GroupingSettings>
                <RemoveButton AltText="Ungroup Column" />
            </GroupingSettings>
            <Columns>
                <ig:BoundDataField DataFieldName="Id" Key="Id" VisibleIndex="0" Hidden="True">
                    <Header Text="Id" />
                </ig:BoundDataField>
                <ig:BoundDataField DataFieldName="Day" Key="Day" Width="60px">
                    <Header Text="Day" />
                </ig:BoundDataField>
                <ig:BoundDataField DataFieldName="Worked" Key="Worked">
                    <Header Text="Worked" />
                </ig:BoundDataField>
            </Columns>
            <Behaviors>
                <ig:EditingCore EnableInheritance="true" AutoCRUD="false">
                    <Behaviors>
                        <ig:CellEditing>
                            <ColumnSettings>
                                <ig:EditingColumnSetting ColumnKey="Id" ReadOnly="True" />
                                <ig:EditingColumnSetting ColumnKey="Day" ReadOnly="True" />
                            </ColumnSettings>
                            <%--<CellEditingClientEvents ExitedEditMode="GridRowUpdate"/>--%>
                            <EditModeActions MouseClick="Single" />
                        </ig:CellEditing>
                    </Behaviors>
                </ig:EditingCore>
            </Behaviors>
        </ig:Band>
    </Bands>
</ig:WebHierarchicalDataGrid>

 

Server side:

    Private Sub form1_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles form1.Init
        AddHandler WebHierarchicalDataGridTS.Bands(0).RowUpdating, AddressOf WebHierarchicalDataGridTS_RowUpdating
        AddHandler WebHierarchicalDataGridTS.Bands(0).RowUpdated, AddressOf WebHierarchicalDataGridTS_RowUpdated
    End Sub


    Private Sub WebHierarchicalDataGridTS_RowUpdated(ByVal sender As Object, ByVal e As Infragistics.Web.UI.GridControls.RowUpdatedEventArgs) Handles WebHierarchicalDataGridTS.RowUpdated
        'Do Stuff
    End Sub

    Protected Sub WebHierarchicalDataGridTS_RowUpdating(ByVal sender As Object, ByVal e As Infragistics.Web.UI.GridControls.RowUpdatingEventArgs) Handles WebHierarchicalDataGridTS.RowUpdating
        'Do Stuff
    End Sub