Search code examples
c#datarepeater

DataRepeater displaying new items unexpectedly


I have a DataRepeater (Microsoft.VisualBasic.PowerPacks) which has 100+ records consisting of about 5 TextBoxes and corresponding labels in each item so that it becomes scrollable. In case it matters, its DataSource is set via this line:

repeater.DataSource = myDataSet.Tables["TableName"];  

The weird thing is this: When I add a new row to this DataRepeater (repeater.AddNew()), it brings the new field at the bottom into focus, but it appears to have copied data from another item. It does not appear to always be the same item. Also, if I am at the bottom of the DataRepeater without anything in the new item focused and scroll away and back again, there is (potentially) different data from yet another random item.

I'm basically at a loss at this point. There is no scroll event that could be causing this, and this change to the item happens without triggering a single event/method of either the DataRepeater or the parent user control.
Has anyone experienced similar issues or have an ides of what could cause this behavior?

Update: Adding multiple new items seem to result in them getting their data from consecutive existing items (ex. 3 new items might show data from items 100-102, scroll away and back again, now they might show data from items 150-152)


Solution

  • You may want to add the newrow to your dataset's table, repeater will update at runtime.