How to select all or deselect all checkboxes in datagrid...

Discussion in 'ASP .Net Datagrid Control' started by Al Knowles, Dec 1, 2003.

  1. Al Knowles

    Al Knowles Guest

    This does not work....

    Sub SetCheckBoxValues(ByVal ab_on_off As Boolean)

    Dim ditem As DataGridItem
    Dim ckbx As CheckBox

    For Each ditem In DataGrid1.Items
    ckbx = CType(ditem.Cells(0).Controls(1), CheckBox)
    If ab_on_off Then
    ckbx.Checked = True
    Else
    ckbx.Checked = False
    End If

    ditem.Cells(0).Controls(1) = ckbx
    Next


    End Sub

    ...because property "item" is read-only.

    Is there a way to accomplish my objective without javascript? (Only
    because I don't know my way around in javascript! But I'll accept
    javascript examples if that's all there is...)

    Please advise.

    Suggestions appreciated. Thanks in advance.
     
    Al Knowles, Dec 1, 2003
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.