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
345
cant delete child row
posted

i have a WHDG with a templated delete button in the child band. clicking the button doesnt fire the javascript, thus the row doesnt delete and thus the code behind doesnt delete the row from the database. BUT if i press the delete key on the keyboard the row deletes as it should. below is the grid and the javascript

<ig:WebHierarchicalDataGrid ID="WebHierarchicalDataGrid1" runat="server" Height="640px"
                                    Width="950px" StyleSetName ="LucidDream" AutoGenerateBands="False"
                                      AutoGenerateColumns="False" DataKeyFields="ResearchID"
                                      DataMember="SqlDataSource3_DefaultView"
                                      DataSourceID="WebHierarchicalDataSource1" Key="SqlDataSource3_DefaultView" InitialDataBindDepth="1" InitialExpandDepth="1"   >
                                    <Bands>
                                        <ig:Band AutoGenerateColumns="False" DataMember="SqlDataSource2_DefaultView"
                                            Key="SqlDataSource2_DefaultView" DataKeyFields="PartID" >
                                            <ExpandButton AltText="Expand Row" />
                                            <CollapseButton AltText="Collapse Row" />

                                            <GroupingSettings>
                                                <RemoveButton AltText="Ungroup Column" />
                                               
                                            </GroupingSettings>
                                            <Columns>
                                             <ig:TemplateDataField Key="DeleteItem" Width="60px">
                        <ItemTemplate>
                            <asp:ImageButton runat="server" ID="DeleteItem" AlternateText="Delete" ImageUrl="../images/DeleteIcon.PNG" OnClick= "DeleteRow(); return false;" OnClientClick="DeleteRow(); return false;" />
                        </ItemTemplate>
                    </ig:TemplateDataField>  
                                                <ig:BoundDataField DataFieldName="PartID" Key="PartID" Hidden="true" width="0px">
                                                    <Header Text="PartID" />
                                                </ig:BoundDataField>
                                                <ig:BoundDataField DataFieldName="ResearchID" Key="ResearchID" Hidden="true" width="0px">
                                                    <Header Text="ID" />
                                                </ig:BoundDataField>
                                                <ig:BoundDataField DataFieldName="Part" Key="Part" width="100px">
                                                    <Header Text="Part" />
                                                </ig:BoundDataField>
                                                <ig:BoundDataField DataFieldName="Quantity" Key="Quantity" width="30px">
                                                    <Header Text="Quan." />
                                                </ig:BoundDataField>
                                                <ig:BoundDataField DataFieldName="PartNo" Key="PartNo" width="120px">
                                                    <Header Text="Part No." />
                                                </ig:BoundDataField>
                                                <ig:BoundDataField DataFieldName="Availability" Key="Availability" width="50px">
                                                    <Header Text="Avail." />
                                                </ig:BoundDataField>
                                                <ig:BoundDataField DataFieldName="TimeLine" Key="TimeLine" width="55px">
                                                    <Header Text="Time Line" />
                                                </ig:BoundDataField>
                                                <ig:BoundDataField DataFieldName="Cost" Key="Cost" width="60px" DataFormatString="{0:c}">
                                                    <Header Text="Cost" />
                                                </ig:BoundDataField>
                                                <ig:BoundDataField DataFieldName="SalePrice" Key="SalePrice" width="60px" DataFormatString="{0:c}">
                                                    <Header Text="Sale Price" />
                                                </ig:BoundDataField>
                                                <ig:BoundDataField DataFieldName="Freight" Key="Freight" width="60px">
                                                    <Header Text="Freight" />
                                                </ig:BoundDataField>
                                            </Columns>
 <Behaviors>
               
              
                <ig:EditingCore Enabled="true">
                    <Behaviors>
                    <ig:CellEditing Enabled ="true" />
                        <ig:RowDeleting Enabled="true" />
                    </Behaviors>
                </ig:EditingCore>
            </Behaviors>

                                        </ig:Band>
                                    </Bands>
<ExpandButton AltText="Expand Row"></ExpandButton>

<CollapseButton AltText="Collapse Row"></CollapseButton>

<GroupingSettings>
<RemoveButton AltText="Ungroup Column"></RemoveButton>
</GroupingSettings>
                                 
                                    <Columns>
                                        <ig:BoundDataField DataFieldName="ResearchID" Key="ResearchID" width="25px">
                                            <Header Text="ID" />
                                        </ig:BoundDataField>
                                        <ig:BoundDataField DataFieldName="ResearchDate" Key="ResearchDate" Width="50px">
                                            <Header Text="Date" />
                                        </ig:BoundDataField>
                                        <ig:BoundDataField DataFieldName="CustomerNo" Key="CustomerNo" Hidden="true" Width="0px">
                                            <Header Text="CustomerNo" />
                                        </ig:BoundDataField>
                                        
                                        <ig:BoundDataField DataFieldName="UserName" Key="UserName"  Width="75px">
                                            <Header Text="Adjuster" />
                                        </ig:BoundDataField>
                                        <ig:BoundDataField DataFieldName="Year" Key="Year" Width="30px">
                                            <Header Text="Year" />
                                        </ig:BoundDataField>
                                        <ig:BoundDataField DataFieldName="Make" Key="Make" Width="65px">
                                            <Header Text="Make" />
                                        </ig:BoundDataField>
                                        <ig:BoundDataField DataFieldName="Model" Key="Model" Width="65px">
                                            <Header Text="Model" />
                                        </ig:BoundDataField>
                                        <ig:BoundDataField DataFieldName="VIN" Key="VIN" Width="110px">
                                            <Header Text="VIN" />
                                        </ig:BoundDataField>
                                        <ig:BoundDataField DataFieldName="Drive" Key="Drive" Width="50px">
                                            <Header Text="Drive" />
                                        </ig:BoundDataField>
                                        <ig:BoundDataField DataFieldName="Transmission" Key="Transmission" Width="55px">
                                            <Header Text="Trans" />
                                        </ig:BoundDataField>
                                        <ig:BoundDataField DataFieldName="PO" Key="PO" Width="65px">
                                            <Header Text="PO" />
                                        </ig:BoundDataField>
                                        <ig:BoundDataField DataFieldName="AOrder" Key="AOrder"  Width="50px">
                                            <Header Text="Ordered" />

                                        </ig:BoundDataField>
                                        <ig:BoundDataField DataFieldName="Denied" Key="Denied"  Width="50px">
                                            <Header Text="Denied" />

                                        </ig:BoundDataField>
                                    </Columns>
                                    <Behaviors>
                                        <ig:Activation Enabled="true">
                                       
                                        </ig:Activation>
                                        <ig:EditingCore >
                                            <Behaviors>
                                                <ig:CellEditing Enabled="false">

                                                </ig:CellEditing>
                                                <ig:RowDeleting Enabled ="true" />
                                            </Behaviors>
                                        </ig:EditingCore>
                                         <ig:Selection RowSelectType="Single" CellClickAction="Row" />
                                    </Behaviors>
                                  
                                 
                                </ig:WebHierarchicalDataGrid>




    <script type="text/javascript">

        function DeleteRow() {
            var grid = $find('WebTab1_tmpl1_WebHierarchicalDataGrid1');
            var gridRows = grid.get_gridView().get_rows();

            var selectedRows = grid.get_gridView().get_behaviors().get_selection().get_selectedRows();
            for (var i = selectedRows.get_length() - 1; i >= 0; i--) {
                var row = selectedRows.getItem(i);
                gridRows.remove(row);
            }
        }
       
    </script>