This is a migrated thread and some comments may be shown as answers.

Detail table with select all checkbox in command item

1 Answer 64 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vatsal
Top achievements
Rank 2
Vatsal asked on 29 Jun 2012, 11:48 AM
Hi,

I have a grid with one GridTableView in <DetailTables> section. In GridTableView, first column is GridTemplateColumn with checkbox. I put one checkbox in GridTableView's command item to implement "Select All" functionality, so when user select this checkbox, particular details tables all rows checkbox should be selected. I want to implement this functionality on client side using javascript if possible otherwise server side code will be also fine.

<telerik:RadGrid ID="radGridReconStatus" GridLines="None" AutoGenerateColumns="false"
        ShowFooter="true" Width="1000px" AllowPaging="false" AllowSorting="true" runat="server"
        AllowAutomaticUpdates="false" Skin="Outlook" Visible="true" OnDetailTableDataBind="radGridReconStatus_DetailTableDataBind"
        OnItemDataBound="radGridReconStatus_ItemDataBound" OnNeedDataSource="radGridReconStatus_NeedDataSource"
        OnItemCommand="radGridReconStatus_ItemCommand">
        <ExportSettings IgnorePaging="true" OpenInNewWindow="true" ExportOnlyData="true"
            HideStructureColumns="true">
            <Pdf PageWidth="1000px" />
        </ExportSettings>
        <HeaderStyle Font-Bold="true" />
        <MasterTableView ShowFooter="true" DataKeyNames="ID" CommandItemDisplay="None">
            <DetailTables>
                <telerik:GridTableView Width="100%" DataKeyNames="REVIEW_ID, KEY_ID" runat="server" Name="Detail"
                    AutoGenerateColumns="false" ShowHeader="true" GridLines="None" AlternatingItemStyle-BackColor="AliceBlue"
                    CommandItemDisplay="Top">
                    <GroupHeaderItemStyle Font-Bold="true" />
                    <CommandItemTemplate>
                        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                            <tr>
                                <td style="color: White;">
                                    <asp:CheckBox ID="chkSelectAll" runat="server" /><b>Select all</b>
                                </td>
                                <td align="right" style="color: White;">
                                    <asp:LinkButton ID="lnkDeleteInternal" runat="server" Font-Bold="true" Text="Delete Internal"
                                        CommandName="DeleteInternal" />
                                       
                                    <asp:LinkButton ID="lnkDeleteExternal" runat="server" Font-Bold="true" Text="Delete External"
                                        CommandName="DeleteExternal" />
                                       
                                    <asp:LinkButton ID="lnkDeleteBoth" runat="server" Font-Bold="true" Text="Delete Both"
                                        CommandName="DeleteBoth" />
                                       
                                </td>
                            </tr>
                        </table>
                    </CommandItemTemplate>
                    <%--<ParentTableRelation>
                        <telerik:GridRelationFields DetailKeyField="REVIEW_ID" MasterKeyField="REVIEW_ID" />
                    </ParentTableRelation>--%>
                    <Columns>
                        <telerik:GridBoundColumn DataField="KEY_ID" UniqueName="KEY_ID" Visible="false" />
                        <telerik:GridTemplateColumn HeaderText="Select" ItemStyle-Width="50px" UniqueName="CHECK_COLUMN">
                            <ItemTemplate>
                                <asp:CheckBox ID="chkSelect" runat="server" Enabled="true" />
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn DataField="KEY_NAME" UniqueName="KEY_NAME" Visible="false"
                            HeaderText="Total Breaks" />
                        <telerik:GridBoundColumn DataField="TRANSACTION_TYPE" UniqueName="TRANSACTION_TYPE"
                            HeaderText="Transaction Type" Visible="true" ItemStyle-Width="250px" />
                        <telerik:GridBoundColumn DataField="INTERNAL_AMOUNT" UniqueName="INTERNAL_AMOUNT"
                            Visible="true" HeaderText="Internal System Amount" ItemStyle-Width="150px" DataFormatString="{0:#,###0}" />
                        <telerik:GridBoundColumn DataField="EXTERNAL_AMOUNT" UniqueName="EXTERNAL_AMOUNT"
                            Visible="true" HeaderText="External Party Amount" ItemStyle-Width="150px" DataFormatString="{0:#,###0}" />
                        <telerik:GridBoundColumn DataField="VARIANCE" UniqueName="VARIANCE" Visible="true"
                            HeaderText="Difference" ItemStyle-Width="100px" DataFormatString="{0:#,###0}" />
                    </Columns>
                </telerik:GridTableView>
            </DetailTables>
            <Columns>
                <telerik:GridBoundColumn DataField="REVIEW_ID" UniqueName="REVIEW_ID" Visible="false" />
                <telerik:GridBoundColumn DataField="RECON_ID" UniqueName="RECON_ID" Visible="false" />
                <telerik:GridBoundColumn DataField="ID" UniqueName="ID" Visible="false" />
                <telerik:GridBoundColumn DataField="REVIEW_COLUMN_VALUE_1" HeaderText="Key1" UniqueName="REVIEW_COLUMN_VALUE_1" />
                <telerik:GridBoundColumn DataField="REVIEW_COLUMN_VALUE_2" HeaderText="Key2" UniqueName="REVIEW_COLUMN_VALUE_2" />
                <telerik:GridBoundColumn DataField="REVIEW_COLUMN_VALUE_3" HeaderText="Key3" UniqueName="REVIEW_COLUMN_VALUE_3" />
                <telerik:GridBoundColumn DataField="REVIEW_COLUMN_VALUE_4" HeaderText="Key4" UniqueName="REVIEW_COLUMN_VALUE_4" />
                <telerik:GridBoundColumn DataField="REVIEW_COLUMN_VALUE_5" HeaderText="Key5" UniqueName="REVIEW_COLUMN_VALUE_5" />
                <telerik:GridBoundColumn DataField="INTERNAL_LOAD_DATE" HeaderText="Internal Load Date"
                    DataFormatString="{0:MM/dd/yyyy}" ItemStyle-Width="75px" />
                <telerik:GridBoundColumn DataField="EXTERNAL_LOAD_DATE" HeaderText="External Load Date"
                    DataFormatString="{0:MM/dd/yyyy}" ItemStyle-Width="75px" />
                <telerik:GridBoundColumn DataField="REVIEW_STATUS" HeaderText="REVIEW STATUS" UniqueName="REVIEW_STATUS" />
                <telerik:GridBoundColumn DataField="BreakCount" HeaderText="BreakCount" UniqueName="BreakCount" />
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>

Can anyone help  me implementing this functionality?

Thanks
Vatsal

1 Answer, 1 is accepted

Sort by
0
Elliott
Top achievements
Rank 2
answered on 02 Jul 2012, 02:09 PM
server side
BDF is a button on the page
not exactly the same but it might help
Protected Sub btnSetBFD_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSetBFD.Click
    Dim i As Integer = 0
    Dim ws As New CommonFunctions
    Dim gItems As GridItemCollection
    Dim gdItem As GridItem
    Dim chkSetBFD As CheckBox
    Dim StoreNumber As Int64
 
    gItems = rgStores.Items
    For i = 0 To gItems.Count - 1
        gdItem = gItems(i)
        chkSetBFD = DirectCast(gdItem.Cells(11).Controls(1), CheckBox)
        StoreNumber = CInt(gdItem.OwnerTableView.DataKeyValues(gdItem.ItemIndex)("StoreNumber"))
        ws.SetBFDFlag(StoreNumber, False)
    Next
    ws = Nothing
End Sub
Tags
Grid
Asked by
Vatsal
Top achievements
Rank 2
Answers by
Elliott
Top achievements
Rank 2
Share this question
or