oncheckchanged autopostback in autogenerated columns

3 posts, 0 answers
  1. Joel
    Joel avatar
    181 posts
    Member since:
    Oct 2006

    Posted 26 Oct 2017 Link to this post

    Is there a way to access/set the oncheckchanged event in an autogenerated checkbox column and have it post back?



  2. Eyup
    Eyup avatar
    3953 posts

    Posted 31 Oct 2017 Link to this post

    Hi Joel,

    Yes, you can access the cell container and find the CheckBox using cell.Controls[0] during the ItemCreated event handler:

    I hope this will prove helpful.

    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Joel
    Joel avatar
    181 posts
    Member since:
    Oct 2006

    Posted 02 Nov 2017 Link to this post

    For documentation purposes this is what I ended up with.


    Private Sub handleCheckBoxToggle(sender As Object, e As EventArgs)
            'Do checkbox stuff
    End Sub
        Private Sub rgHotJobs_ItemDataBound(sender As Object, e As GridItemEventArgs) Handles rgHotJobs.ItemCreated
            If TypeOf e.Item Is GridDataItem Then
                Dim dataItem As GridDataItem = DirectCast(e.Item, GridDataItem)
                Dim d As CheckBox
                d = DirectCast(dataItem("Ignore").Controls(0), CheckBox)
                d.Enabled = True
                d.AutoPostBack = True
                AddHandler d.CheckedChanged, AddressOf handleCheckBoxToggle
            End If
        End Sub
Back to Top