Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Checkbox in Datagrid

xianxianxianxian Member Posts: 5

i have a column in my Datagrid that contains Checkboxes..
i need the user to select the Checkbox then store the id value of that row, into an ArrayList. i have done that & it works.

The problem is, when user deselects a Checkbox, how do i remove the id of that row from the ArrayList?

thanks in advance,


  • xianxianxianxian Member Posts: 5
    i finally had it working :-

    Protected Sub RowChanged(ByVal sender As System.Object, ByVal e As
    Dim a As New ArrayList
    If Not Session("SelectResults") Is Nothing Then
    a = CType(Session("SelectResults"), ArrayList)
    End If

    Dim dgItem As DataGridItem = CType(CType(sender,
    Control).NamingContainer, DataGridItem)
    Dim rec As Integer = CInt(dgItem.Cells(9).Text)

    If Not a.Contains(rec) Then
    Dim chkSel As CheckBox = CType(dgItem.Cells(0).Controls(1),
    If chkSel.Checked = False Then
    End If
    End If

    Session("SelectResults") = a
    End Sub

    *PS: "rec" is a record number, just a unique item for every Checkbox in
    my Datagrid.
    Note that I have to first check whether the item is in my Arraylist,
    before i check for Checked=False. If i do it the other way round, it
    would not work.

    in HTML, just add OnCheckedChanged="RowChanged" :-


    This is just my own example, the reference is at ""
    titled "Checking for Changed items" in the section "Editing Multiple Rows At Once"
Sign In or Register to comment.