0

I have a WinForms application that retrieves items from a database and displays them in a list:

<Delete Button><Edit Button><Checkbox><PartNumber><PartDescription>

The Checkbox is unbound and enables users to select as many of the parts listed and then edit properties on those items. The problem I am having is when I select a checkbox at runtime. I can select an item and then quickly scroll down the list and all of a sudden, many of the other items' checkboxes get checked...seemingly in a random fashion. It's as if when I scroll, the datarepeater is firing events on the checkboxes or something. I'm not really sure. The checkboxes work fine otherwise, and enable the user to select the item correctly, I just can't figure out why the random checking / unchecking of the checkboxes.

JJJ
  • 32,902
  • 20
  • 89
  • 102

2 Answers2

0

I think it has to do with the CheckBox control in the DataRepeaterItem is not databound. All the other fields are, but the checkbox isn't so when I scroll up and down the Repeater, the checkboxes lose their state. I'm currently reworking my class object to allow the "Checked" state of each item to be preserved.

Anyone confirm or deny that this is what's happening?

Thanks!

0

this happened to me once when I set the repeater's data source before I setup the binding source. I hope it points you in the right direction. Here is an excerpt from my code

    Dim sres As New frmSearchResults
    Dim dt As DataTable = resultsDataTable
    With sres
        .lblDate.DataBindings.Add(New Binding("Text", dt, "createtime", True))
        .lblOwner.DataBindings.Add(New Binding("Text", dt, "owner", True))
        .lblTicketNumber.DataBindings.Add(New Binding("Text", dt, "ticketnumber", True))
        .lblTitle.DataBindings.Add(New Binding("Text", dt, "tickettitle", True))
        .txtExcerpt.DataBindings.Add(New Binding("Text", dt, "excerpt", True))
        .btnLoad.DataBindings.Add(New Binding("Tag", dt, "ticketid", True))


        .dr1.DataSource = dt 'this used to come before my bindings above

        sres.Show()

    End With