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

oncheckchanged autopostback in autogenerated columns

2 Answers 38 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joel
Top achievements
Rank 2
Joel asked on 26 Oct 2017, 05:44 PM

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

 

 

2 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 31 Oct 2017, 07:36 AM
Hi Joel,

Yes, you can access the cell container and find the CheckBox using cell.Controls[0] during the ItemCreated event handler:
https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/rows/accessing-cells-and-rows

I hope this will prove helpful.

Regards,
Eyup
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.
0
Joel
Top achievements
Rank 2
answered on 02 Nov 2017, 12:59 PM

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
Tags
Grid
Asked by
Joel
Top achievements
Rank 2
Answers by
Eyup
Telerik team
Joel
Top achievements
Rank 2
Share this question
or