Get all checked values from GridClientSelectColumn

2 posts, 0 answers
  1. Vivek
    Vivek avatar
    1 posts
    Member since:
    Jul 2015

    Posted 30 Jul 2015 Link to this post

    Hello,

     I am trying to find the values of the checkbox which are checking on button click event but its not work.

    Please help me out on this.

     

    This is aspx file.

    <telerik:RadGrid ID="RadGridActivity" AutoGenerateColumns="False"  runat="server" AllowMultiRowSelection="True" FilterType="CheckList" GroupPanelPosition="Top"  >
            
            <ClientSettings Selecting-AllowRowSelect="true" >
               <ClientEvents OnRowSelected="RowSelected" OnRowDeselected="RowDeselected" />
            </ClientSettings>
            <MasterTableView>
                <Columns>
                   
                    <telerik:GridClientSelectColumn  UniqueName="SelectActivity" HeaderText="Select" ></telerik:GridClientSelectColumn> 
                    <telerik:GridBoundColumn UniqueName="ActivityId" HeaderText="ActivityId" DataField="intActivityId" FilterDelay="200" ></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="ActivityName" HeaderText="Activity" DataField="strActivityName" AllowFiltering="true" ></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="Company" HeaderText="Company" DataField="strCompany" AllowFiltering="true"></telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
            <ClientSettings EnableRowHoverStyle="true" >

                <Selecting AllowRowSelect="True"></Selecting>
            </ClientSettings>
        </telerik:RadGrid>
        <telerik:RadButton ID="btnAdd" runat="server" Text="Add"></telerik:RadButton>

     

    Code behind

     

    Protected Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click

            For Each item As GridDataItem In RadGridActivity.SelectedItems
                Dim id As String
                Dim chec As Boolean

                Dim chk As CheckBox = DirectCast(item("SelectActivity").Controls(0), CheckBox)
                id = item("ActivityId").Text
                chec = chk.Checked

            Next

        End Sub

     ​

  2. Eyup
    Admin
    Eyup avatar
    3690 posts

    Posted 04 Aug 2015 Link to this post

    Hi Vivek,

    You are in the right direction. You can traverse the SelectedItems collection provided by the grid and extract the item values:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/rows/accessing-cells-and-rows#accessing-raw-field-data-and-key-values

    Let me know if this works for you.

    For more advanced scenario, I suggest that you examine the sample provided in the following post:
    http://www.telerik.com/support/code-library/get-selected-items-through-all-pages#1eTU8nr-GUG8zfGgOGbIcA

    Regards,
    Eyup
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top