GridClientSelectColumn

This is a short code example that shows how to use the Telerik GridClientSelectColumn column, and how to retrieve selected values in the codebehind

Related Articles

... and you 'll find more on the Telerik ASPNET Grid Menu

Note that we have ClientSettings-Selecting-AllowRowSelect="true"

also: AllowMultiRowSelection ="true"

 

<telerik:RadGrid ID="RadGrid1" runat="server"   AutoGenerateColumns="false" AllowMultiRowSelection="true" ClientSettings-Selecting-AllowRowSelect="true"
        ShowFooter="false" PageSize="999" Width="100%" AllowPaging="false"  AllowCustomPaging="false" >
    <MasterTableView DataKeyNames="address2"   >
        <Columns>
            <telerik:GridClientSelectColumn></telerik:GridClientSelectColumn>                
            <telerik:GridButtonColumn CommandName="None" ButtonType="LinkButton"  DataTextField="address2" ></telerik:GridButtonColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

Place a button on the form, and code the button click event like this

Dim strAddress2 As String = ""
Dim intRowID As Int32
For Each oRow As GridDataItem In RadGrid1.SelectedItems
    'get a key value
    intRowID = RadGrid1.MasterTableView.DataKeyValues(oRow.ItemIndex)("RowID")
    'get a grid value
    strAddress2 = oRow("Address2").Text
Next

 

4/18/2020 Just found a piece of code that I've really been needing: How to pre-select the checkboxes on this column:

Private Sub RadGrid1_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound
    Dim oRow As DataRowView
 
    If TypeOf e.Item Is Telerik.Web.UI.GridDataItem Then
 
        'get a reference to the data
        oRow = CType(e.Item.DataItem, DataRowView)
        'this is a field in the data source
        Dim bSelected As Boolean = oRow("Selected")
 
        'get a reference to the grid column
        Dim item As GridDataItem = CType(e.Item, GridDataItem)
 
        If bSelected Then
            'note that we're not saying 'item.visible', 'item.enabled', 'item.checked'...
            item.Selected = True
        End If
 
    End If
End Sub

 

 

 



RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences