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

Get all checked values from GridClientSelectColumn

1 Answer 218 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vivek
Top achievements
Rank 1
Vivek asked on 30 Jul 2015, 11:04 AM

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

 ​

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 04 Aug 2015, 06:53 AM
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
Tags
Grid
Asked by
Vivek
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or