Enable postback on Radgrid checkbox header

1 Answer 19 Views
Ajax CheckBox Grid
Sylvain
Top achievements
Rank 1
Sylvain asked on 03 May 2021, 03:09 PM

Dear all,

 

I have the below radgrid defininition in my aspx page in which the selectionColumn is a checkbox. When I click on row, the postback is fired and I can calculate the sum of all selected rows and then display the results in the footer.

However when I click on the header checkbox, then all the lines are selected but the postback event is not fired.

Which property should be enable? Or maybe should it be managed differently?

My goal is to display in the footer, the sum of selected rows whatever it is by selection some specific rows or by using the select/unselect all checkbox.

Thanks

 

                                    <MasterTableView ShowFooter="true" DataKeyNames="ID" PageSize="50">
                                        <Columns>
                                            <telerik:GridClientSelectColumn HeaderStyle-Width="50px"></telerik:GridClientSelectColumn>
                                            <telerik:GridBoundColumn DataField="ID" FilterControlAltText="Filter on Chunk Key" HeaderText="Chunk Key" UniqueName="ID" HeaderStyle-Width="100px">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="PurchaseContract" FilterControlAltText="Filter on Purchase Ctr" HeaderText="Purchase Ctr" UniqueName="PurchaseContract" HeaderStyle-Width="150px">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="Supplier" FilterControlAltText="Filter on Supplier" HeaderText="Supplier" UniqueName="Supplier">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="ShipmentStatus" FilterControlAltText="Filter on Ship. Status" HeaderText="Ship.Status" UniqueName="ShipmentStatus">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="ShipmentDate" FilterControlAltText="Filter on Ship. Date" HeaderText="Ship. Date" UniqueName="ShipmentDate" DataFormatString="{0:dd/MM/yyyy}">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="ShipmentRef" FilterControlAltText="Filter on Ship. Ref" HeaderText="Ship. Ref" UniqueName="ShipmentRef" HeaderStyle-Width="250px">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="FinancingBank" FilterControlAltText="Filter on Financing Bank" HeaderText="Financing Bank" UniqueName="FinancingBank">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="FinancingRef" FilterControlAltText="Filter on Financing Ref." HeaderText="Financing Ref." UniqueName="FinancingRef">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="NetWeight" FilterControlAltText="Filter on NetWeight" HeaderText="Net Weight" UniqueName="NetWeight" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="Warehouse" FilterControlAltText="Filter on Warehouse" HeaderText="Warehouse" UniqueName="Warehouse">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="CustomsStatus" FilterControlAltText="Filter on CustomsStatus" HeaderText="Customs Status" UniqueName="CustomsStatus">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="Customer" FilterControlAltText="Filter on Customer" HeaderText="Customer" UniqueName="Customer">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="SaleContract" FilterControlAltText="Filter on SaleContract" HeaderText="Sale Ctr" UniqueName="SaleContract">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="SaleInvoiceNb" FilterControlAltText="Filter on SaleInvoiceNb" HeaderText="Sale Invoice Nb" UniqueName="SaleInvoiceNb">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="Vessel" FilterControlAltText="Filter on Vessel" HeaderText="Vessel" UniqueName="Vessel">
                                            </telerik:GridBoundColumn>
                                        </Columns>
                                    </MasterTableView>
                                    <ClientSettings EnableRowHoverStyle="true" EnablePostBackOnRowClick="true">
                                        <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" FrozenColumnsCount="0"></Scrolling>
                                        <Selecting AllowRowSelect="true"></Selecting>
                                    </ClientSettings>
                                    <PagerStyle AlwaysVisible="true" Mode="NumericPages" Position="Bottom" />
                                </telerik:RadGrid>

 

Sylvain
Top achievements
Rank 1
commented on 05 May 2021, 07:05 AM

Dear all,

Any idea on how I can sort out this problem?

1 Answer, 1 is accepted

Sort by
0
Attila Antal
Telerik team
answered on 06 May 2021, 11:03 AM

Hi Sylvain,

The built-in GridClientSelectColumn does not make a PostBack. You will need to use GridTemplateColumns with a CheckBox in its HeaderTemplate that will Select all rows when checked, and one CheckBox in the ItemTemplate that will select the current row.

To achieve that you can follow the instructions from our Documentation at Server-side Selecting with a CheckBox

Regards,
Attila Antal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Ajax CheckBox Grid
Asked by
Sylvain
Top achievements
Rank 1
Answers by
Attila Antal
Telerik team
Share this question
or